【问题标题】:htaccess multiple urls to one page redirect not workinghtaccess 多个 url 到一页重定向不起作用
【发布时间】:2018-03-08 02:32:25
【问题描述】:

我有一堆像https://example.com/index.php?articles_id=XX 这样的网址,其中XX 是某个数字。我想要 将它们全部重定向到https://example.com/maps.php(忽略参数),但我使用的重定向代码都不起作用。参观时 原始 url,浏览器只是循环直到它最终超时。第二个 url 指向一个工作页面。

我第一次尝试:

    RewriteRule ^articles_id=(.*)$ /maps.php [L,R=301]

然后

    RewriteRule ^https://example.com/index.php?articles_id=(.*)$ /maps.php [L,R=301]

然后

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php?articles_id=\ HTTP/ 
    RewriteRule ^index\.php?articles_id=$ https://example.com/maps.php [R=301,L]

最后

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php?articles_id=\ HTTP/ 
    RewriteRule ^(.*)$ ./maps.php [R=301,L]        

文件中还有其他重定向代码在起作用,比如这个:

    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ 
    RewriteRule ^index\.php$ https://example.com/ [R=301,L]        

有人可以指出重定向不起作用的原因吗?

【问题讨论】:

标签: .htaccess redirect


【解决方案1】:

这原来是文件中阻止重定向的代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-06
    • 2014-11-25
    • 1970-01-01
    • 1970-01-01
    • 2018-02-15
    相关资源
    最近更新 更多