0

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.

Steve
  • 203
  • 6
  • 13

2 Answers2

1

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] 
Manhal
  • 34
  • 2
  • Thanks, it almost works but if i use it as you did, the CSSs of the second site (mysite2) doesn't load. If i invert the order of the rules, then it happends only with mysite1. Therefor, i guess it still being something wrong in the rules as depending on the order it acts in one way or another. What could it be?? – Steve Feb 08 '13 at 09:43
  • Ok. It seems that the first two `RewriteCond` about files or folders are not being applied to the second `RewriteRule`. I've solved it adding again the 2 `RewriteCond` after the first `RewriteRule`. It works well now but... is it correct? Why is it happening? Thanks. – Steve Feb 08 '13 at 10:12
1

Assuming your directory names correspond with the domain names e.g. www.mySite.com has it's files located in directory /mySite/ and www.myOtherSite.com has it's files in /myOtherSite/ then you could try the following:

[ISAPI_Rewrite]
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST}        ^(www\.)?([^.]*)\.com$
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule .*    /%2/index.php?url=%{REQUEST_URI} [L,QSA] 
arober11
  • 417
  • 3
  • 6
  • One of the sites has a domain (`www.website.com`), the other is just a subfolder inside a subdomain (`www.demo.website.com/website2/`) I dont know if it would be so simple in this case. – Steve Feb 08 '13 at 09:46