سؤال

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.

هل كانت مفيدة؟

المحلول 3

Finally I did it like this:

RewriteEngine on 
RewriteBase /

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

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

########## SITE 3 (by URL) 
RewriteCond %{HTTP_HOST} ^mysite3.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mysite3.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?url=$1 [L, QSA]

نصائح أخرى

than I can't come up with anything better than this:

########## SITE 1 
RewriteEngine on 
RewriteCond %{HTTP:Host} ^www\.website\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /mysite1/index.php?url=$1 [L,QSA] 

########## SITE 2
RewriteEngine on 
RewriteCond %{HTTP:Host} ^www\.demo\.website\.com$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /mySecondSite/index.php?url=$1 [L,QSA] 

In case the names of your folders are the same as the names of the sites:

RewriteEngine on 

RewriteCond %{HTTP:Host} ^www\.([^.]+)\.com$
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /%1/index.php?url=$1 [L,QSA] 
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top