我的.htaccess文件是这样的:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)$ user.php?u=$1 [NC]
RewriteRule ^albums/(.*)$ albums.php?gallery=$1 [NC]
关于用户页面的规则(user.php)有效,但关于相册页面的规则(albums.php)会导致此错误:
err_too_many_redirects
答案 0 :(得分:1)
重新排序您的规则:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^albums/(.*)$ albums.php?gallery=$1 [L,NC]
RewriteRule ^(.*)$ user.php?u=$1 [L,NC]