【发布时间】:2016-01-04 00:15:54
【问题描述】:
我基本上试图将所有不是文件(.css、.js、.jpg 等)的内容重写为 index.php 以创建符号链接。我在 .htaccess 文件中的代码适用于我的根目录和单个子目录 So。 “localhost/”和“localhost/help”都可以工作,但“localhost/help/article-27”不起作用。当我尝试使用第二个子目录(包括 JS 和 CSS 文件)时,.htaccess 似乎重写了 everything。有谁知道这是为什么?这是我的代码:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
【问题讨论】:
-
你应该不需要那里的
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]行。 -
help/也有 .htaccess 吗?
标签: php apache .htaccess mod-rewrite