2015-09-06 61 views
3

子域我想重定向到URL localhost/annolocalhost/tut/annohtaccess的重定向子文件夾不改變網址

我提到this question

,並寫了這.htaccess規則

RewriteCond %{HTTP_HOST} ^(www\.)?localhost\anno$ [NC] 
RewriteRule !^localhost/ /tut/anno%{REQUEST_URI} [L,NC] 

不過還是我得到404錯誤。

我的規則是什麼問題?

回答

2

您可以使用:

RewriteEngine on 
RewriteRule ^anno/(.*)$ /tut/anno/$1 [NC,L] 

該內部重定向 「/阿魯/富」 到 「/嘖嘖/阿魯/ foo」 的

編輯

你需要重新排序的規則是這樣:

RewriteEngine On 

RewriteRule ^anno/(.*)$ /tut/annotorious/$1 [NC,L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
+0

嘿,謝謝,它工作時,我喜歡[你的](https://eval.in/428634)但不起作用,如果我喜歡[this](https ://eval.in/428635).... –