Derek Organ
Derek Organ

Reputation: 8473

Apache Mod-Rewrite rule to skip sub directory

I have a application in the root directory of a website that has its own apache2 mod-rewrite rules e.g.

   RewriteRule ^/([^/]*)/([^/]*)/$ /index.php?page=$1&var1=$2
   RewriteRule ^/([^/]*)/$ /index.php?page=$1

Thats fine but now I want to install Wordpress in a the subdirectory /blog. Wordpress of course has its own rewrite statements in the .htacess file that rewrites urls differently for the blog.

How can I tell the root .htaccess file to skip over the /blog/ directory and allow the local .htaccess mod-rewrite to still work when browsing int the blog directory.

Upvotes: 1

Views: 1211

Answers (2)

anubhava
anubhava

Reputation: 785128

Use this code in your .htaccess under DOCUMENT_ROOT:

RewriteRule ^blog/ - [L]

RewriteRule ^/([^/]*)/([^/]*)/$ index.php?page=$1&var1=$2 [L,QSA]
RewriteRule ^/([^/]*)/$ index.php?page=$1 [L,QSA]

Upvotes: 0

androidavid
androidavid

Reputation: 1259

You just do a negation in your first htaccess like

RewriteCond %{REQUEST_FILENAME} !^/blog/.*$

this should do it - hopefully! as a precondition of the rules

Upvotes: 2

Related Questions