2016-10-03 35 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>