我确实运行了Apache几年,但我无法在Apache上运行。所以现在我使用Nginx,但我不能让rewriterule像我想的那样工作。
我总是运行一个PHP脚本(/index.php
),如果链接中的文件存在,如果没有,但永远不会返回404(这是由PHP完成的)。由于安全性,我需要重定向。安全设置存储在数据库中,所以我真的需要这个PHP脚本始终作为第一个运行。
在Apache中,我使用了以下配置:
<Directory /var/www/html>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php
</Directory>