重定向301每个URL都带有index.php?www.domain.com/subpage.htm



我尝试重定向URL,例如:http://www.domain.com/index.php?option=com_acesef& limitstart = 100& tag = barajas&tag = barajas&到 :http://www.domain.com/subpage.html也就是说,任何像www.domain.com/index.php一样开始的URL"远程"?重定向到唯一的www.domain.com/subpage.html

我该如何在.htaccess中执行此操作?

我回答自己。我发现这种情况的最好的是:

RewriteRule ^index.php$ /subpage.html? [L,R=301]

在情况下,查询字符串(QSA)index.php之前有些东西?像在此URL中:domain.com/directorio/index.php?id=123

domain.com/directorio/index.php?txt=alert

并希望它将其重定向到:domain.com/subpage.html(无需querystring)

您应该这样做:

RewriteRule index.php$ /subpage.html? [L,R=301]

wiithoout first ^

最新更新