ReWriteRules and WordPress Multi-Sites with Sub Directories

I’m having a diffucult time getting the ReWriteRules and URL structures setup for a WordPress 3.4.2 (latest version as of this post) blog with multi-site enabled. is the homepage of an e-commerce site.

We also have

As our category and product URL structures. This is all working.

I have installed the wordpress files in the physical folder /var/www/ourdomain/wordpress. Right now, goes to the default blog. is the first blog and is the second.

I’ve got to this point by adding

ReWriteRule ^/wordpress - [L,NC]

to our vhost file (.htacess is diasabled).

Our intention is for direct requests (from users) for*) to redirect to the home page since the /wordpress folder is just to store files, not intended as an actual blog for users to access.

Requests for should silently redirect to Requests for should silently redirect to


/wordpress/ -> 301 /
/blog/ -> silent /wordpress/blog1
/policies/ -> silent /wordpress/blog2

It seems simple in theory, but not so simple in practice.

I started with:

ReWriteRule ^/wordpress - [L,NC]
RewriteRule ^/blog/(.*)$ /wordpress/blog/$1 [L,NC]  
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^/blog/ /wordpress/blog/index.php [L]

Which results in a 404 at /blog/. Of course, because /wordpress/blog/index.php isn’t a file. There is no blog folder inside the wordpress folder. The file I want to load is /wordpress/index.php, which reads the URL to determine which blog to load- But the URL has been modified, so this fails. I need a way to invoke /wordpress/index.php from the URL /blog/, but make /wordpress/index.php see the request as if the user went to /wordpress/blog.

Any way to pass a fake URI to PHP from modRewrite? Or an alternative way to achieve this without installing to separate copies of WordPress?


Since this doesn’t seem to be supported in the current version, but I still need this working before the new version is released, I think a work around would be to use something like:

RewriteRule ^/blog/ /wordpress/index.php?site=blog [L]

And then modify the WordPress file that reads the URL and have it set the site variable based on the GET parameter instead. Would that work? Which file contains the code to set the current site?

Solutions Collecting From Web of "ReWriteRules and WordPress Multi-Sites with Sub Directories"