![](/img/trans.png)
[英]Redirect homepage to a different page using htaccess on a Drupal site
[英]Redirect page to homepage using htaccess
我有一個很好的重寫規則設置:
RewriteRule ^circuit/([a-zA-Z0-9-]+)/([^/]*)$ /circuit.php?id=$2 [L]
我要的是,如果有人訪問了http://www.example.com/circuit.php ,它將重定向到主頁,但是如果有人訪問了http://www.example.com/circuit/some-,電路/ 3 ,它仍然可以工作。
我試過簡單地使用這種方法:
Redirect /circuit.php http://www.example.com/
這在重定向circuit.php中有效,但是它也停止了動態頁面的工作,我敢肯定有一個簡單的答案。
這應該工作:
RewriteCond %{THE_REQUEST} /circuit\.php [NC]
RewriteRule ^ / [L,R=302]
RewriteRule ^circuit/([a-zA-Z0-9-]+)/([^/]*)$ /circuit.php?id=$2 [L,QSA,NC]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.