【发布时间】:2015-01-02 09:39:35
【问题描述】:
我的旧 .htaccess 文件中有这段代码
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+index\.php\?page=([a-z0-9]+) [NC]
RewriteRule ^ %1/%2/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9]+)/?$ /index.php?page=$1 [L,NC]
我最近升级到了 nginx,我在配置中使用了以下代码,而不是 Apache 重写规则。
rewrite ^/(.*)$ /index.php?page=$1$args? last;
这也很好,但是当我尝试在 /Style/Main.css 中加载我的样式表时,它会尝试将文件作为获取请求加载。我怎样才能解决这个问题,让它不这样做?
【问题讨论】:
-
有人吗?我仍然需要一个答案。
标签: apache .htaccess mod-rewrite nginx