How to rewrite rules for two subfolders using mod_rewrite

.htaccessisapi-rewritemod-rewrite

I would need to do something like this:

########## SITE 1 
RewriteEngine on 
RewriteBase /mysite1  
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] 

########## SITE 2
RewriteEngine on 
RewriteBase /mySecondSite   
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] 

The problem is that i can only use one .htaccess file as I am using Helicon ISAPI_Rewrite 3 over windows 2003 Server.

Is there a way to combine both .htaccess files in just one of them and making them work properly?

I have tried this just to test if mysite would work without the RewriteBase, but seems not to work:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^mysite1/(.*)$ index.php?url=$1 [L,QSA] 

Thanks.

Best Answer

Try this

RewriteEngine on 
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^mysite1/(.*)$ mysite1/index.php?url=$1 [L,QSA] 
RewriteRule ^mysite2/(.*)$ mysite2/index.php?url=$1 [L,QSA] 
Related Topic