homepage Welcome to WebmasterWorld Guest from 54.167.238.60
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
.htaccess
Domain Pointer
move360




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

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

 

jdMorgan




msg:1505743
 11:08 pm on Jun 12, 2003 (gmt 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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved