# These settings routes all traffic, except concrete files, to the dispatcher
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]
问题是它确实将具体文件路由到调度程序:(
如何才能忽略像 http://site.com/style.css
这样的 URL?
最佳答案
试试这个并让我知道:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.php [NC,L]
您将所有内容重写到index.php,这将检查文件/文件夹/符号链接(symbolic link)是否存在,然后加载文件(如果存在)。
关于php - 不要重写代表文件的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9370875/