我有一堆网址如https://example.com/index.php?articles_id=XX,其中XX是一些数字。我想要 将所有这些重定向到https://example.com/maps.php(忽略参数),但我使用的重定向代码都没有。访问时 原始网址,浏览器只是循环,直到它最终超时。第二个网址是工作页面。
我第一次尝试:
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]
有人可以指出重定向不起作用的原因吗?
答案 0 :(得分:0)
原来这是防止重定向的文件中的代码。