[英]htaccess redirect subfolder to subdomain without changing url
我想重定向到url localhost/anno
到localhost/tut/anno
我提到了這個問題
並寫了這個.htaccess
規則
RewriteCond %{HTTP_HOST} ^(www\.)?localhost\anno$ [NC]
RewriteRule !^localhost/ /tut/anno%{REQUEST_URI} [L,NC]
但我仍然得到404錯誤。
我的規則有什么不對?
您可以使用 :
RewriteEngine on
RewriteRule ^anno/(.*)$ /tut/anno/$1 [NC,L]
這內部將“/ anno / foo”重定向到“/ tut / anno / foo”
編輯
你需要像這樣重新安排你的規則:
RewriteEngine On
RewriteRule ^anno/(.*)$ /tut/annotorious/$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.