[thelist] .htaccess for two URLs

kasimir-k kasimir.k.lists at gmail.com
Mon Jun 4 08:03:06 CDT 2007


Fred Jones scribeva in 04/06/2007 9:10:
>>> I have two domain names and I want the secondary one to be sent to a 
>>> subdirectory, meaning that if you request 
>>> http://secondsite.com/aboutus.php the server will deliver 
>>> http://mainsite.com/secondsite/aboutus.php
>>>
>>> I tried this
>>>
>>> RewriteCond %{HTTP_HOST} !mainsite.com
>>> RewriteRule ^(.*)$ /secondsite/$1
>>>   
>> Have you tried this:
>>
>> RewriteEngine on
>> RewriteCond %{HTTP_HOST} !mainsite.com
>> RewriteRule ^(.*)$ /secondsite/$1 [R,L]
> 
> Also fails. I enter secondsite.com and get 
> mainsite.com/secondsite/secondsite/secondsite ad infinitum until it errors.

Wouldn't you then just add a second condition to check that the URI 
doesn't already start with /secondsite?

RewriteCond %{HTTP_HOST} !mainsite.com
RewriteCond %{REQUEST_URI} !^/secondsite

.k



More information about the thelist mailing list