Mod_rewrite AH00124错误

时间:2015-03-02 06:58:46

标签: apache .htaccess mod-rewrite

我想创建一个重写规则,以便

http://domain.ext/truc.php?id=value

将映射到

http://domain.ext/value

所以我在.htaccess中写了这条规则:

RewriteEngine On
RewriteRule ^([^/]*)$ /truc.php?id=$1 [L]

但这会产生500永久性错误。

日志说明:

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

任何人都可以帮助,请:) ManyThx

亨利

1 个答案:

答案 0 :(得分:0)

是的,此处存在无限循环,因为您的规则始终路由到/p.php。使用RewriteCond来阻止它:

RewriteEngine On
RewriteBase /

# If the request is not for a valid directory
RewriteCond %{REQUEST_FILENAME} !-d
# If the request is not for a valid file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ p.php?linkID=$1 [L,QSA]