2013-02-10 97 views
1

我的WordPress安裝在我的根目錄下,它的htaccess重寫規則阻止我訪問example.com/file.php,而是重定向到/從htaccess重寫規則中排除特定文件

我想從重寫規則中排除該特定文件。

現有的htaccess:

RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 

# uploaded files 
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] 

# add a trailing slash to /wp-admin 
RewriteRule ^wp-admin$ wp-admin/ [R=301,L] 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 
RewriteRule ^(wp-(content|admin|includes).*) $1 [L] 
RewriteRule ^(.*\.php)$ $1 [L] 
RewriteRule . index.php [L] 

回答

0

您需要添加

RewriteCond $1 !^(file\.php) 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 
RewriteRule ^(wp-(content|admin|includes).*) $1 [L] 
RewriteCond $1 !^(file\.php) [L] 
RewriteRule ^(.*)$ /index.php/$1 [L] 
+0

不過重定向:/ – developdaly 2013-02-10 16:36:56

+0

盡我editted答案。如果這不起作用 - 嘗試chaning /index.php到index.php(即刪除/) – Laurence 2013-02-10 16:39:15

+0

不行。我以不同的順序移動了'file.php'這一行,並且沒有預先加入'index.php'斜線。任何其他想法? – developdaly 2013-02-10 16:47:08