Tuesday, 15 March 2011

php - Exclude a specific file from htaccess rewrite rules -



php - Exclude a specific file from htaccess rewrite rules -

i have wordpress installed in root , htaccess rewrite rules preventing me accessing example.com/file.php , instead redirects /.

i want exclude 1 specific file rewrite rules.

existing htaccess:

rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] # uploaded files rewriterule ^files/(.+) wp-includes/ms-files.php?file=$1 [l] # add together trailing slash /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]

you need add

rewritecond $1 !^(file\.php)

i.e.

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]

php wordpress .htaccess

No comments:

Post a Comment