Welcome to WebmasterWorld Guest from 54.162.248.199

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess

Domain Pointer

     
3:51 am on Jun 12, 2003 (gmt 0)

10+ Year Member



I have had my domain for year and I have registered a new domain that is pointed to my main domain. Using my .htaccess can I have the second domain point to a specific directory?

For example, my regular domain is www.maindomain.com I registered www.seconddomain.com. I would like www.seconddomain.com to point to www.maindomani.com/second

Is this possible? I want to give the illusion that my www.seconddomain.com site is on a different server.

Cheers,

Ed

11:08 pm on Jun 12, 2003 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



move360,

Welcome to WebmasterWorld [webmasterworld.com]!

This is fairly easy if you can use mod_rewrite on your server.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?seconddomain\.com
RewriteRule ^(.*)$ /second/$1 [L]

Things get a bit more complex if you are using scripts with query strings:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?seconddomain\.com
RewriteCond %{QUERY_STRING} ^product=(.*)$
RewriteRule ^(.*)$ /second/$1?product=%1 [L]
RewriteCond %{HTTP_HOST} ^(www\.)?seconddomain\.com
RewriteRule ^(.*)$ /second/$1 [L]

Ref: Introduction to mod_rewrite [webmasterworld.com]

HTH,
Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month