Help in configuring .htaccess to exclude a path from rewriting
I have a root folder with the following .htaccess configuration
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
开发者_运维知识库# otherwise forward it to index.php
RewriteRule . index.php
What I need is, I have installed a wordpress site in a sub directory 'blog/'
. Now I am able to access the home page of the blog since I have givien RewriteCond %{REQUEST_FILENAME} !-d
. But clicking on a post will redirect me to the index file in root folder. How can I solve this. Please help. Thanks in advance.
Add a RewriteCond to exclude paths which begin with "blog/" Something like (added some existant rule for context)
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?blog/
Not tested, but you get the idea
精彩评论