[英]RewriteRule for 301 redirect
我在重寫規則問題上經歷了所有已回答的線程。 嘗試了這些建議,但我仍然不知道我做錯了什么。
我想將舊網址301重定向到新網址。 例:
old url : http://www.xyz.com/abc/topics.html
new url : http://www.xyz.com/index.php#first
我正在嘗試遵循.htaccess中的規則:
RewriteEngine on
RewriteRule ^\/abc\/(.+)$ http://www.xyz.com/index.php#first [L,R=301]
任何建議都非常感謝
試試這個:
RewriteRule ^abc\/(.+)$ http://www.example.com/index.php#first [L,R=301,NE]
當然,您可以通過“mod_rewrite”來實現,但在這種情況下,我建議您使用mod_alias,因為它更快更簡單(請參閱此SO響應: mod_rewrite或mod_alias? )
像這樣:
Redirect permanent /abc http://www.xyz.com/index.php#first
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.