1

I'm using this .htaccess file but it doesn't work:

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^(.*)$ /index.php?$1 [R,L] 

What I see in Apache error log is [Error: Over 10 times of redirecting internally]. I added the flag 'L' in RewriteRule but it doesn't stop after the first time matching the rewrite rule.

4

1 回答 1

3

如果您运行的是 v2.2.16+,则使用 FallbackResource,请参阅:https ://httpd.apache.org/docs/2.2/mod/mod_dir.html#fallbackresource

FallbackResource /index.php

另一种方法是使用 mod_rewrite,代码如下:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
于 2013-09-08T10:38:49.060 回答