【发布时间】:2021-12-28 21:54:09
【问题描述】:
我有一个使用 Joomla 1.5 的旧网站。它与 GET 参数有一些奇怪的链接,如下所示:
http://www.primavista.ru/images/stories/catalog/?rand=1186511674
http://www.primavista.ru/images/stories/catalog/?rand=145388433
http://www.primavista.ru/images/stories/catalog/?rand=1553907057
http://www.primavista.ru/images/stories/catalog/?rand=1563973527
http://www.primavista.ru/images/stories/catalog/?rand=1981273478
http://www.primavista.ru/images/stories/catalog/?rand=2139631800
http://www.primavista.ru/images/stories/catalog/?rand=366928750
http://www.primavista.ru/images/stories/catalog/?rand=524689684
http://www.primavista.ru/images/stories/catalog/?rand=569077423
http://www.primavista.ru/images/stories/catalog/?rand=573405687
http://www.primavista.ru/images/stories/catalog/?rand=879649167
我想将这些链接重定向到主页。 我在 .htaccess 中尝试了一些不同的指令:
RewriteCond %{QUERY_STRING} ^/images/stories/catalog/?rand=([0-9]*)$
RewriteRule ^(.*)$ https://primavista.ru/? [R=301,L]
RewriteCond %{QUERY_STRING} ^/images/stories/catalog/?rand=(.*)$
RewriteRule ^(.*)$ https://primavista.ru/? [R=301,L]
RewriteCond %{QUERY_STRING} (^|&)(rand)=[^&]+ [NC]
RewriteRule ^images/stories/catalog(/.*)?$ https://primavista.ru/? [R=301,L,NC]
但是没有人不工作。也许这里有人可以帮助我。谢谢
【问题讨论】:
-
将不良 URL 重定向到主页对 SEO 不利或不利。它们应该返回“404 Not Found”或“410 Gone”状态,最好带有自定义错误页面,解释它们不再可用的原因并列出替代方案。
-
也许你是对的。但是我怎样才能使重定向有效?
-
你不应该做这样的重定向,所以不要尝试这样做。
-
但我真的需要从这些链接进行重定向
-
你能退后一步解释一下这个重定向的目的吗?
标签: .htaccess redirect http-status-code-301 joomla1.5 getparameter