[thelist] htaccess mod_rewrite help please!!!

Stephen Rider evolt_org at striderweb.com
Tue Oct 3 16:27:52 CDT 2006

Hello all --

I have what is probably an unusual issue, here, so I hope  
you .htaccess experts can help me out.  I'll try to be brief, but it  
takes a bit of explaining...

I have an install of Wordpress blog software that I want to use to  
run multiple blogs.  To do this, I am using a method where basically  
I have the install in one directory /blog/ and a symbolic link, / 
blog2/ (and /blog3/, /blog4/...) that points to the /blog/ directory.

The only change to the basic Wordpress code is that the config.php  
file that gets us into the database is replaced with a bit of code  
that says "If we're in /blog/, call this config file; if we're in / 
blog2/, call that config file".  The different config file points to  
a different database, and thus you have a totally different blog with  
the one install.  Method detailed here: <http://www.mertner.com/allan/ 

Everything working swimmingly so far.  Except...

Wordpress uses a default mod_rewrite (in the /blog/.htaccess file) to  
customize the hierarchy of posts.  The default rewrite block is thus:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

This works just great for the first blog at /blog/, but for the one  
at /blog2/ (the symbolic link "directory"), the rewrite kicks in as  
though we're in /blog/.

Can anyone help me rework this?  I want to tell the rewrite block,  
essentially, "If the directory structure starts with /blog/, point  
to /blog/index.php.  If it starts with /blog2/ point to /blog2/index.php

I'm pretty sure this would work with the right RewriteCond, but I  
can't figure out how to phrase it.

Thank you so much for any help.  I've been beating my head against  
this install for a while now!

Stephen Rider

More information about the thelist mailing list