Welcome to WebmasterWorld Guest from 54.227.101.214

Message Too Old, No Replies

301 Concerns for Unique IP Sites

     

Billy Batson

9:44 pm on Jun 15, 2005 (gmt 0)

10+ Year Member



Hi,

I just discovered that Google has listings for my site's IP address (rather than url), which may trigger dup. content filter.

I suggest that if folks are on unique IP addresses, they do a search for site:your.ip.numbers.here - if you find any listings, add a 301 redirect to your .htaccess file.

RewriteEngine On
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^your\.ip\.numbers\.here [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

[edited by: ciml at 9:12 am (utc) on June 16, 2005]
[edit reason] Examplified [/edit]

reseller

11:46 am on Jun 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Billy Batson

>I just discovered that Google has listings for my site's IP address (rather than url), which may trigger dup. content filter.
I suggest that if folks are on unique IP addresses, they do a search for site:your.ip.numbers.here - if you find any listings, add a 301 redirect to your .htaccess file.<

Thanks. That underline again the importance of adding a 301 redirect (which has been discussed on several threads).

Billy Batson

11:50 am on Jun 16, 2005 (gmt 0)

10+ Year Member



You're welcome. I'm surprised nobody mention it before.

I can't see what use it is having IP listings in Google anyway.

theBear

2:15 pm on Jun 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Billy Batson,

It has been mentioned many times before.

But once again here is a proper redirect ruleset for servers on port 80 (default) and running Apache.


RewriteEngine On
# prevent uncovering files in a directory without a valid index file
Options -Indexes
# prevent the uncovering of a valid index file
rewriteCond %{THE_REQUEST} ^.*\/index\.shtml
rewriteRule ^(.*)index\.shtml$ http://www.example.com/$1 [R=301,L]
# You need one of these for each valid index type you allow to be an index page
# redirect all valid aliases to the www form
RewriteCond %{HTTP_HOST}!^www\.example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Note the RewriteCond is for all valid aliases and even would cover properly parked vanity domains (warning depending on a number of factors parked vanity domains may be far more trouble than you want).

Please watch out for forum software mangling posting of such items. I did bracket the code with code container markup.

Oh and for folk using cPanel/WHM the hotlink protection has been known to blow away the contents of .htaccess when activated or deactivated, and it also appears that just clicking on that icon will activate it.

jdMorgan

2:33 pm on Jun 16, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Here's a tweak to prevent an infinite redirection loop with old HTTP/1.0 clients, plus a couple of other minor adjustments:

RewriteEngine On
# prevent uncovering files in a directory without a valid index file
Options -Indexes
# prevent the uncovering of a valid index file
# (you need one of these for each valid index type you allow to be a index page)
RewriteCond %{THE_REQUEST} /index\.shtml
RewriteRule ^(.*)index\.shtml$ http://www.example.com/$1 [R=301,L]
# redirect all valid aliases to the www form
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

The added RewriteCond prevents an "infinite" redirection loop if HTTP_HOST is blank. Removing the [NC] from the domain name match requires an all-lowercase domain name to prevent upper- or mixed-case domain name duplicates.

Jim

theBear

5:13 pm on Jun 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To be on the totally safe side I concur with what Jim is saying.

Even though hitting my sites with both http 1.0 and 1.1 clients casued no problems.

I also agree with Jim saying to drop the [NC] even though the standards say that the Host is not case sensitive.

Who knows what someone will do to mess up the works.

And you should remember that even this is not the best way to handle hostname issues.

This is second best.

First is a proper server setup only allowing one visable server alias.

Jim, thank you for your information and time, it will help plug even more holes.

Vulcan315

3:42 am on Jun 19, 2005 (gmt 0)

10+ Year Member



I'm a little confused with the "rewrite" statements in the first few posts...

In my .htaccess file, i have statements that look like this:

redirect 301 /index.htm [mydomain.com...]
redirect 301 /dirt.htm [mydomain.com...]

...etc. Now, how do I have it to 301 redir requests for the IP address to the domain name? Is it like:

redirect 301 [mydomain.com...]

...or...

redirect 301 ip.address [mydomain.com...]

Thanks,
Dave

Vulcan315

3:53 am on Jun 19, 2005 (gmt 0)

10+ Year Member



... a little more... I thought I had it figured out, when I inserted the following string into the .htaccess:

redirect 301 / [mydomain.com...]

...'cause it would redirect the IP entry to the top domain. But, when I performed the "Server Header Check", it not only reported that the IP address had moved to www.mydomain.com, it reported that www.mydomain.com had moved to www.mydomain.com, hehehheheh... Any ideas on how to correctly write the .htaccess string?

Thanks,
Dave

 

Featured Threads

Hot Threads This Week

Hot Threads This Month