2012-02-01 87 views
1

我有这个问题: 我有一个.htaccess文件女巫重写所有我的网址index.php 我有几个文件夹的例外。.htaccess:重定向除了几个文件夹以外的所有东西

这句话很好,但是当一个文件不存在于其中一个文件夹中时,他仍然会重写。但他可能不会这样做。

我该如何解决这个问题?

我的代码:

RewriteEngine On 

RewriteRule ^(templates|images)/ - [L] 

RewriteRule ^(favicon\.ico) - [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteRule .* index.php [L] 

回答

4

试试这个:

RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-l 
RewriteCond %{REQUEST_URI} !^/(templates|images|favicon\.ico) [NC] 
RewriteRule .* index.php [L,NC] 
+0

没了,还是同样的问题。 – 2012-02-01 12:49:17

+1

这很奇怪。 当我手动去网址,它显示我404错误。但index.php从这个URL调用(我可以在我的日志中看到这个) 任何想法? – 2012-02-01 12:56:46

+0

你有其他规则? – 2012-02-01 23:24:54

相关问题