Forum Moderators: phranque

Message Too Old, No Replies

Addon Domains

domain names redirect

         

cyberdyne

7:03 pm on Apr 28, 2011 (gmt 0)

10+ Year Member


Hi
I have 5 domain names; 1 x main domain (domain1.com) and 4 x addon domains (domain[2-5].com) which are set to redirect to the main domain's index file (domain1.com/index.htm).

Currently though, if someone visits a page at one of the addon domains, the addon domain name remains in the address bar for both the index file and subsequent pages (ie: domain[2-5].com/index.htm).

I would like all pages & files requested to be served from my main domain, domain1.com, to ALWAYS show in the address bar regardless of the domain the file requested was requested from.

What can I do to achieve this please?
(I use cPanel and have addon / parked / redirect features available).

Thanks in advance.

cyberdyne

7:31 pm on Apr 28, 2011 (gmt 0)

10+ Year Member



I currently have the following in my .htaccess but only hits on the domain actual domains ([www]domain[2-5].com) are resulting in a redirect to the main domain, not hits on files and/or directories, eg: [www]domain[1-5].com/html/page.html.

RewriteCond %{HTTP_HOST} ^domain2.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain2.com$
RewriteRule ^/?$ "http\:\/\/www\.domain1\.com\/" [R=301,L]

cyberdyne

9:34 pm on Apr 28, 2011 (gmt 0)

10+ Year Member



Ok, so I've tried converting the addon domains into parked domains which now ensures all domains point to my main domain. It also means I only have one set of logs to read which is good.

However, I'd still like to redirect all files and folders if possible.

Again, any help appreciated.
Thanks in advance.

g1smd

10:05 pm on Apr 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This code has been posted close to 5000 times in the various WebmasterWorld forums. :)

RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]


The code redirects all non-canonical requests including those with a port number.

cyberdyne

10:16 pm on Apr 28, 2011 (gmt 0)

10+ Year Member



But knowing what to search for is not always obvious.
Thank you.

cyberdyne

10:25 pm on Apr 28, 2011 (gmt 0)

10+ Year Member



Should this particular code be used with addon domains or parked domains?

My domains are currently set as parked and this code does not work as expected.

caran1

1:43 am on May 1, 2011 (gmt 0)

10+ Year Member



Check with your hosting company. The script may not work if your web hosting server configuration is non standard.