[英].htaccess 301 redirect with exceptions
我最近將我的asp網站轉換為php。 URL保持不變,但顯然mysite.com/ / .asp頁面變成了mysite.com/ / .php,我使用此.htaccess條目進行重定向(並且效果很好):
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.asp$ $1.php [R=301, L]
我的問題是,我不得不更改一些舊的URL,因此上述規則無法正常運行。 是否可以向.htacces添加其他規則,以覆蓋上述全局規則? 喜歡
Redirect 301 /path/page.asp mysite.com/path/page_new.php
如果可能的話,放在哪里?
謝謝。
堅持使用mod_rewrite,因為您已經在使用它,而不是通過mod_alias(Redirect)進入混合。
只需before
全面規則before
添加要重定向的網址即可。
RewriteEngine on
RewriteBase /
RewriteRule ^specific\.asp$ /path/page_new.php [R=301,L]
RewriteRule ^specific2\.asp$ /path/page_new2.php [R=301,L]
RewriteRule ^(.*)\.asp$ $1.php [R=301, L]
讓我知道如何解決。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.