2011-01-26 46 views
0

我需要爲子域編寫Apache的重寫規則。該規則應基於:子域和文件夾的重寫規則

subdomain.domain.com => /home/domain/docs/some_folder/file.php?subdomain=subdomain 
subdomain.domain.com/edit => /home/domain/docs/some_other_folder/file.php 
subdomain.domain.com/dashboard/display/id => /home/domain/docs/some_other_folder2/file.php?param1=display&param2=id 

我也使用AJAX調用其上不會輕鬆地工作,因爲我是從搜索互聯網瞭解的網站。所以一些暗示也會真的有幫助。

我真的很感謝你的幫忙! 在此先感謝。

回答

0

我要去嘗試這種

RewriteEngine on 
RewriteBase/

RewriteCond %{HTTP_HOST} !^subdomain.domain.com$ 
RewriteRule .* - [L] 

RewriteCond %{HTTP_HOST} (.*) 
RewriteRule ^$ /home/docs/some_folder/file.php?subdomain=%1 [L,QSA] 
RewriteRule ^edit$ /home/docs/some_other_folder/file.php [L] 
RewriteRule ^dashboard/(\w+)/(\w+) /home/docs/some_other_folder2/file.php?param1=$1&param2=$2 [QSA,L]