Forum Moderators: phranque

Message Too Old, No Replies

301 redirect questions

Different Domain Names, Same IP

         

hthrdwn

11:46 pm on Oct 1, 2003 (gmt 0)

10+ Year Member



I was recently hired as a SEO for a web hosting business. They have several clients with 2 or more domain names. The problem is that the DNS points these different domain names to the same IP address and each address is seen as it's own separate site: ie, Blue Shoe Company has tow domain names, blueshoes.com points to IP 10.10.100.11 and blueshoecompany.com also points to the same IP.

I am trying to make it so that blueshoes.com redirects to blueshoecompany.com but am not sure how to go about doing this.

redirect 301 / [blueshoecompany.com...]

The above line does not work because it is causing blueshoecompany.com to redirect to itself and the site stops loading. Will I need to suggest that we assign an IP to each domain name or is there another way to do this? They've been working this way for quite a while and will need some very good reasons to assign IPs to each just so that they can be redirected.

Can I accomplish a redirect like this through a mod_rewrite? If so, does anyone have any ideas that I can pass on the programmer.

DaveAtIFG

10:55 am on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld hthrdwn! :)

Your poor ole redirect is just doing what you told it to do... ;)

From the Apache docs [httpd.apache.org]:

Syntax: Redirect [status] URL-path URL
You are redirecting from the root folder (URL-path) of your site to the URL that resides at the root of your site.

I think RedirectMatch [httpd.apache.org] is probably what you are looking for.

Syntax: RedirectMatch [status] regex URL
I'm no regex expert but something like this should get you going in the right direction:
RedirectMatch 301 ^blueshoes\.com [blueshoecompany.com...]

You could add RedirectMatch directives for additional domains. If you have many domains, a mod_rewrite solution could also be used that could "distill" a lengthy series of RedirectMatch directives into any few lines.

jdMorgan

5:17 pm on Oct 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



hthrdwn,

Welcome to WebmasterWorld [webmasterworld.com]!

In order to discriminate between the two domains, you'll need to test the {HTTP_HOST} variable, that is, the domain requested by the browser that ended up on your server. If it is not the "primary" domain name, then redirect it to the primary.

To do this, you'll need to use mod_rewrite, which may or may not be available to you.

Several examples of the code to accomplish what you need have been posted in this forum. Message number 3 in this thread [webmasterworld.com] shows the code; simply substitute the domain name you want to redirect into the first line, and the one you want to keep into the second line.

Note that this code is "forgiving" of www- and non-www variants, as well as upper/lowercase variants. This may not be what you want, but you can change it easily.

Jim

hthrdwn

6:58 pm on Oct 2, 2003 (gmt 0)

10+ Year Member



I'm trying to present this as simply as possible so that the powers that be will be less likely to tell me that it's too much work. I understand we do have at least one client with more URLs than you can count on all your fingers & toes, so it's important that there is an "easy" fix for them as well. So thanks so much for allowing me to arm myself with suggestions/solutions.