2012-10-04 42 views
0

ISAPI v3有沒有辦法讓一個子域只打一個特定的文件夾,其他的請求都會重定向到www?我在這個文件夾下還有一些需要重寫的網址。還將有有效的www網址的重寫規則。ISAPI重寫 - 允許一個子域只打一個特定的文件夾

允許:

http://myaccount.mysite.com/account/

http://myaccount.mysite.com/account/profile/

http://myaccount.mysite.com/account/profile/changeEmail.aspx

允許的,但需要重寫:

http://myaccount.mysite.com/account/edit/123456789.aspx

這些應該被重定向到www:

http://myaccount.mysite.com/directory/

http://myaccount.mysite.com/folder1/

http://myaccount.mysite.com/folder1/folder2/ 等....

回答

0

嘗試使用以下:

RewriteEngine on 
RewriteBase/

RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC] 
RewriteRule ^account/edit/123456.aspx$ /otherpage [NC,L] 

RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC] 
RewriteRule ^account/.*$ - [NC,L] 

RewriteCond %{HTTP:Host} ^myaccount\.mysite\.com$ [NC] 
RewriteRule (.*) http://www.mysite.com/$1 [NC,R=301,L] 
相關問題