doumang20060820
doumang20060820
2012-02-21 01:21

不要重写代表文件的URL

已采纳
# These settings routes all traffic, except concrete files, to the dispatcher

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^(.*)$ index.php [NC,L]

The problem is that it does route concrete files to the dispatcher :(

How can I make it so URLs like http://site.com/style.css are ignored?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • douxin8610 douxin8610 9年前

    Try this and let me know:

    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]
    

    You were rewriting everything to the index.php, this will check if the file/folder/symlink exists and then load the file if it does.

    点赞 评论 复制链接分享

相关推荐