Apache 将所有内容(包括实际文件/目录)重写为一个文件

Apache 将所有内容(包括实际文件/目录)重写为一个文件,apache,.htaccess,mod-rewrite,url-rewriting,Apache,.htaccess,Mod Rewrite,Url Rewriting,这会重写所有内容,但实际文件除外: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d [OR] RewriteRule ^(.*)$ index.php/$1 [L] 如何将“所有内容”重写到index.php,包括实际的文件请求?尝试用以下内容替换2行重写内容: RewriteCond %{REQUEST_URI} !^/index\.php/ 这将阻止重写循环,并且您的重写规则已设置为重写所有内

这会重写所有内容,但实际文件除外:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteRule ^(.*)$ index.php/$1 [L]

如何将“所有内容”重写到
index.php
,包括实际的文件请求?

尝试用以下内容替换2行重写内容:

RewriteCond %{REQUEST_URI} !^/index\.php/

这将阻止重写循环,并且您的重写规则已设置为重写所有内容(条件是阻止您重写现有文件)

导致500,将其更改为
!php
做到了这一点。那么,这一切背后的原因是什么呢?嗯,但仅仅是
!index.php
它不会重写更深层次的
index.php
文件,因此会解析这些文件。对不起,没考虑就把它打出来了。