0
这是我在我的开发环境至今:的.htaccess重写“/book.php?id=1234”到“/电子书/ 1234”
php_value error_log log/php.log
php_value display_errors 1
php_value magic_quotes_gpc Off
RewriteEngine On
# remove slash
RewriteCond %{REQUEST_FILENAME} !-d
# file.php to /file
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteCond %{REQUEST_URI} !^/ajax.php
RewriteRule ^(.+)\.php$ http://localhost/$1 [R=301,L]
# /file to file.php
RewriteRule ^([^/.]+)$ $1.php [L]
我已经尝试了很多变种这条规则,但我总是得到一个500错误:
RewriteRule ^(.*)$ /book.php?url=$1 [L]
而且这是在我的Apache的error.log中:
[Fri Jul 27 19:56:51 2012] [error] [client 127.0.0.1] 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.
我缺少什么,为什么重定向循环?
此外,有没有一种使规则完全独立于域的方法?我想避免在本地/ qa/prod环境中更改此文件 – agbb 2012-07-27 23:09:29
或仅仅是'RewriteRule^book /([^ /] *)$ /book.php?id=$1 [L]'。 最后但并非最不重要的,尝试添加:'RewriteBase /' – 2012-07-31 22:30:27