2016-10-03 111 views
0

我使用RewriteRule缩短了从?s = xxx到/ xxx的链接 - 但我遇到了一些问题,无法访问某些文件夹中的文件。为了帮助我在规则中有个例外:重写规则 - 授予文件夹的访问权

RewriteRule ^(inv.*) $1 [L] 

这是因为我在文件夹“inv”中有.pdf文件。

但问题是,我也有一些网站被称为/邀请。问题是这个链接给404错误。

如果我收回上面的行,/邀请工程 - 但然后我得到/inv/xx.pdf 404错误。

如何更改使这两个作品的RewriteRule。

谢谢。

这是我整个.htaccess文件:

DirectoryIndex i.php index.php index.html 
RewriteEngine On 
RewriteRule ^robots.txt - [L] 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(wp-(content|admin|includes).*) $1 [L] 
RewriteRule ^(.*\.php)$ $1 [L] 
RewriteRule ^(inv.*) $1 [L] 
RewriteRule ^([^/]+)/?$ /?s=$1 [NC,L] 
RewriteRule ^(nyhet)/([^/]+)/?$ /?s=$1&n=$2 [NC,L] 
RewriteRule ^([^/]+)/([^/]+)/?$ /?s=$1_$2 [NC,L] 
ErrorDocument 404 http://www.domain.com/404 
ErrorDocument 403 http://www.domain.com/404 

回答

0

禁用reportory contenu通过

Options All -Indexes 

然后修复文件的规则

<Files ~ "([.][^][*])^.*\."> 
order allow,deny 
deny from all 
satisfy all 
</Files>