连续重定向循环

时间:2013-06-13 20:51:24

标签: .htaccess mod-rewrite redirect

我正在尝试为名为“mypage”的mypage.php创建一个URI别名。对mypage.php发出的任何请求都应重定向到别名。

我的.htaccess看起来像这样:

# Mapped aliases
RewriteRule ^mypage$ /mypage.php [L] # <---- Performs a 301, but shouldn't

# Redirects
RewriteRule ^mypage.php$ /mypage [L,R=301]

结果是一个连续的重定向循环。

1 个答案:

答案 0 :(得分:0)

试试这个:

# Mapped aliases
RewriteRule ^mypage$ /mypage.php?redirect=off [L]

# Redirects
RewriteCond %{QUERY_STRING} !redirect=off
RewriteRule ^mypage.php$ /mypage [L,R=301]
相关问题