forwarding to the same file path?

Using a single web hosting account to host multiple sites

forwarding to the same file path?

Postby justinmc » Mon Mar 19, 2007 1:04 pm

I am forwarding all requests for domain1.com/* to subdomain.domain2.com... I'm wondering if there's anyway to capture the * part of the request so that the same file path is served at the new domain...

In otherwords,

domain1.com/foo.html -> subdomain.domain2.com/foo.html
and
domain1.com/dir/bar.html -> subdomain.domain2.com/dir/bar.html
and so on...

?

thanks in advance for any help...

Justin
justinmc
 
Posts: 1
Joined: Mon Mar 19, 2007 12:56 pm

Postby richardk » Tue Mar 20, 2007 11:53 am

If domain1.com has it's own document roots, you can try this in a .htaccess file in domain1.com's document root
Code: Select all
Redirect 301 / http://subdomain.domain2.com/


Else try this in a .htaccess file in domain1.com's document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(www\.)?domain1\.com$ [NC]
RewriteRule ^(.*)$ http://subdomain.domain2.com/$1 [R=301,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 118 guests

cron