Mod_rewrite AH00124 错误

Mod_rewrite AH00124 error

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

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

将映射到

http://domain.ext/value

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

RewriteEngine On
RewriteRule ^([^/]*)$ /truc.php?id= [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

蒂埃里

是的,这里有一个无限循环,因为您的规则不断路由到 /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= [L,QSA]