[英]301 Redirect URLs with special characters to homepage htaccess
我有大約 90 個看起來像這樣的 URL....
www.domain.com/index.php?page=about-us
www.domain.com/index.php?page=Testimonials
www.domain.com/index.php?page=contact-us-2
www.domain.com/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=184&cntnt01origid=68&cntnt01returnid=68
等等等等
我需要對包含 /index.php 的任何 URL 執行通配符 301 重定向嗎? 到主頁。 我該怎么做?
謝謝
您可以將此規則用作站點根目錄 .htaccess 中的第一條規則:
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/+index\.php[?/\s] [NC]
RewriteRule ^ /? [L,R=301]
RewriteCond %{QUERY_STRING} ^(?:page|mact)= [NC]
RewriteRule ^ /? [L,R=301]
?
after /
in target URI 是為了去除index.php?
之后存在的任何查詢字符串index.php?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.