Question

I have a VHOST with the following rule

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^.*$ /router.php [NC,QSA,L]

Pretty much just makes every URL go through an advanced routing system

However, its becoming a conflict when trying to set up my news system using WordPress.

All I need help with is creating a new rewrite rule to put all through the router with the exception of one directory, for example named "wordpress."

Its all on my local machine, but here is the entire VHOST config

 <VirtualHost *:80>
   DocumentRoot "/Users/tyler/Documents/mysite"
   ServerName mysite.local

   RewriteEngine on
   RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
   RewriteRule ^.*$ /router.php [NC,QSA,L]

   <Directory "/Users/tyler/Documents/mysite">
     AllowOverride All
     Order allow,deny
     Allow from all
   </Directory>

 </VirtualHost>
Was it helpful?

Solution

All I need help with is creating a new rewrite rule to put all through the router with the exception of one directory, for example named "wordpress."

Based on that criteria, you should add the following rule to the mix:

RewriteCond %{REQUEST_URI} !^/wordpress

Which will make the whole ruleset now be as follows:

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/wordpress
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^.*$ /router.php [NC,QSA,L]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top