我想把/index.php?id=1&time=10重定向到/first-10。
.htaccess
RewriteEngine On
RewriteCond %{QUERY_STRING} id=1&time=10
RewriteRule ^index\.php$ /first-10/? [L,R=301]当我访问/index.php?id=1&time=10时,重定向到/first-10/,但这是一个404页。请注意最后的斜杠。
问题出在哪里?
发布于 2015-05-14 22:29:44
您需要在内部重写它的旧格式。
必须使用THE_REQUEST来避免无限循环。
RewriteEngine On
RewriteCond %{THE_REQUEST} \s/(?:index\.php)?\?id=1&time=10\s [NC]
RewriteRule ^ /first-10? [R=301,L]
RewriteRule ^first-10$ /index.php?id=1&time=10 [L]http://example.com/index.php?id=1&time=10和http://example.com/?id=1&time=10都将重定向到http://example.com/first-10。http://example.com/first-10将在内部将其重写回/index.php?id=1&time=10发布于 2015-05-14 22:29:51
如果问题确实是.htaccess,则结果页是正确的,并调用重定向,我修改如下:
"?“当第一个-10/和[L,R=?或者是在前10分钟之后?
https://stackoverflow.com/questions/30248437
复制相似问题