Forum Moderators: open

Message Too Old, No Replies

Multiple URLs, single IP address

Yet another question about 301 redirects

         

wormtowndj

11:01 pm on Jan 29, 2009 (gmt 0)

10+ Year Member



I’m relatively new to this world, so the usual apologies for my apparent unwillingness to check previous forum posts…I promise I tried, but I still have questions.

I was recently saddled with the task of refining SEO for my new company, which has experienced quite a bit of growth in the past and acquired several smaller businesses. As I fixed obvious problems in the html, I found that new rankings might appear for other URLs, and not for the one I thought I was updating.

Turns out someone had set up AT&T DNS Admin for each of eight different URLS, all but one of which are remnants of companies that no longer exist. Each of them point to the same IP address with a “@.” A record. It’s clear after reading many forum posts that this is not the right way to handle things. Understand, though, that it is a management directive that these site names not die and always point people to our parent site, even though no html currently exists for them.

Correct me if I'm wrong, but it seems clear that the 301 redirect is the primary answer to my problem (and then I'll see who is still linking to the old URLs). Given that there is currently only one IP address and only one physical website, I think I need to first contract with a web hosting company to establish a new site (to hold the 301 redirects) and then to set up each page to redirect to the proper page on the parent site. Then I can change the @. A record for each of the now defunct sites to point to this new IP address (which would then properly redirect them where they currently point directly). At that point, only the primary URL would be using our current IP address.

Sorry for the lenghty explanation, but will this work? It sounds ridiculous when I write it down. Thank you in advance for your help.

jdMorgan

12:46 am on Jan 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If all of these various domains resolve to your server's IP address, then it's likely (depending on your server and your privilege level) that you can redirect requests for these non-canonical hostnames to the canonical hostname without involving any other server. (Keywords in italics)

If you have server-configuration-level privileges on Apache, you can modify the <VirtualHost> configurations to redirect all but the canonical domain to the canonical domain using mod_alias or mod_rewrite (Apache modules).

If you don't have server-config-level privileges on Apache, then you can use mod_rewrite in .htaccess to check the requested hostname, and redirect if it isn't the canonical hostname. In this case mod_rewrite is required because mod_alias cannot execute conditionally based on the requested hostname.

If you are on Microsoft IIS, then you can probably use the control panel to do this. If not, then look into purchasing and using the ISAPI Rewrite package if it isn't already available.

Only in rare cases (where none of the above solutions are available) should it be necessary to set up another server to handle this problem.

A search here on WebmasterWorld for "canonical domain" and "canonical hostname" combined with your server type (Apache or IIS) should return several useful results.

Jim

wormtowndj

8:39 pm on Jan 30, 2009 (gmt 0)

10+ Year Member



Wow, thanks for the quick reality check. Very helpful.

I do not have server-config-level privileges. I tried modifying .htaccess some weeks ago and inadvertantly created a loop that brought everything down, so I had been shying away from that. However, I spent the morning following your suggestion, and I'm wondering now if all I really need is the following:

RewriteCond %{HTTP_HOST} !^www\.canonical-name\.com$ [NC]
RewriteRule ^(.*)$ [[i]canonical-name[...] [R=301,L]

Which would not only add the www requirements on all urls, but would simultaneously replace any non-canonical name with the canonical name. Could it be that simple?

And do I understand correctly that after a few weeks, the google rankings for the non-canonical sites should (in theory) be replaced by the canonical names?

jdMorgan

9:12 pm on Jan 30, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If your domains all resolve to the same server and the same filesystem on that server, then yes it can be that simple. However, your [NC] flag on the RewriteCond would allow non-canonical case variations to go uncorrected, and you don't need to anchor the "maximally-greedy" (.*) pattern:

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

If you have no other RewriteRules already working in this file, then you will need to add either the second of these lines, or both the first and second of these lines ahead of your rule. I can't be more specific, because the first line may be required on your server, or it may not be needed, or it may not be allowed, depending on your server configuration. The only way to find out is to test:

Options +FollowSymLinks
RewriteEngine on

Jim

wormtowndj

9:36 pm on Jan 30, 2009 (gmt 0)

10+ Year Member



All those conditions are true, and there are already RewriteRules working in the file, so I added the two lines above and it worked perfectly.

canonical-name.com now resolves to www.canonical-name.com
NON-canonical-name.com now resolves to www.canonicalname.com

Many thanks. You exposed me to some very important info and saved us a monthly web-hosting fee for years to come.

[edited by: caveman at 2:45 am (utc) on Jan. 31, 2009]
[edit reason] Removed site mention per TOS [/edit]