Redirect subdomain or subdirectory to addon domain

Using a single web hosting account to host multiple sites

Redirect subdomain or subdirectory to addon domain

Postby Falcon1986 » Mon Apr 13, 2009 5:50 am

Hello all!

I have a main domain and an addon domain. AddonDomain.com physically resides in /public_html/addondomain/ of MainDomain.com's document root.

Currently, there is no problem accessing AddonDomain.com, but it can also be accessed by going to either MainDomain.com/addondomain/ or addondomain.MainDomain.com.

How can I redirect any form of the latter two requests to AddonDomain.com?

Thank you in advance.
Falcon1986
 
Posts: 8
Joined: Sun Oct 19, 2008 10:56 am

Postby richardk » Mon Apr 13, 2009 1:28 pm

Try (in /public_html/addondomain/.htaccess)
Code: Select all
Options +FollowSymLinks

RewriteEngine On

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

Postby Falcon1986 » Tue Apr 14, 2009 5:06 am

Thank you, 'richardk'! It worked!
Falcon1986
 
Posts: 8
Joined: Sun Oct 19, 2008 10:56 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 23 guests

cron