Welcome to WebmasterWorld Guest from 54.167.46.29

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

.htaccess

Domain Pointer

     

move360

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

Inactive Member
Account Expired

 
 


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 June 12, 2003 (gmt 0)

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 0


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

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members