Welcome to WebmasterWorld Guest from 54.161.99.20

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Trouble with 301 to correct Y! dupe problem...

     
2:20 am on Jun 20, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2004
posts:89
votes: 0


I posted this as part of a message in another section, but it seems to only pertain to Y! search in my situation (don't see search results returning dupe content as ip address _AND_ domain name with other engines). I don't know how this happened, but Y! is showing search results with both, and I think it may be causing me to have a dupe penalty.

So, here goes... I still have one problem to solve, if anyone knows how to do it... My searches on Y! for my site return the IP address, instead of the domain name (well, actually it seems to return both at times). I think it may be costing me a duplicate content penalty of some sort. Anyway, I would like to have the use of the IP address to be redirected to the top domain name with a 301, but can't figure out what the string should be in the .htaccess file. I've experimented a bit, and found strings like:

redirect 301 [mydomain.com...]
redirect 301 / [mydomain.com...]

..to redirect the ip address to the top domain (http://www.mydomain.com), but when I run a header check, www.mydomain.com is _also_ redirected as a 301...not good. I can't figure out what to put in the .htaccess string to include do something like this:

redirect 301 #$!@.IP.ad.rs [mydomain.com...]

...and actually make it work. I think I'm overlooking something, as the above string seems to do nothing.

As usual, any help is much appreciated!

Dave

3:58 pm on June 20, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2004
posts:89
votes: 0


OK... a bit more..here's what I've done and the result:

I've uploaded the following as an experiment (thanks, Jim, hope you have a great vacation!), and found that it would redirect someone entering the ip only, to the domain name...

Options +FollowSymLinks
RewriteEngine on
# redirect all valid domain aliases to the www form
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.mysite\.com
RewriteRule (.*) [mysite.com...] [R=301,L]

However, it caused another problem... I only want the search engine or people who enter!@#.my.IP.ad to go to www.scootworks.com. I don't want everything that starts with!@#.my.IP.ad to be redirected, as that is screwing up my shopping cart. Example, if!@#.my.IP.ad redirects to www.mysite.com, that's great. But!@#.my.IP.ad/anything_else needs to be left alone...if that makes any sense... Any ideas on what I can do to the above statement to fix that?

Thanks a million!

Dave

3:59 pm on June 20, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2004
posts:89
votes: 0


...sorry about that, I meant to substitute my site domain with "www.mysite.com", I see I over looked one...

Dave

2:26 am on June 21, 2005 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 9, 2005
posts:1509
votes: 0


Hi Dave,

I am not sure exactly what your file is called for the index, but if you substitute rule's regular expression, which is a 'catch all', with a more specific pattern, you should be fine:

RewriteRule ^(index\.html)?$ http://www.yoursite.com/$1 [R=301,L]

The specific pattern above of index.html followed by a ? will match yoursite.com/index.html OR yoursite.com/, but nothing else.

A ? following a character or pattern specifies 0 or 1 of the immediately preceding characters or sets of characters.

() create and store a variable.

\. matches a single .(dot) not 'any character, except the end of a line'

Hope this helps.

Justin

BTW for the httpd.conf file instead of the .htaccess you will need to chage the left side to ^/(index\.html)?$

5:51 am on June 21, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2004
posts:89
votes: 0


Hi Justin,

I swapped the rule to the following in .htaccess:

Options +FollowSymLinks
RewriteEngine on
# redirect all valid domain aliases to the www form
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.mysite\.com
RewriteRule ^(index\.html)?$ [mysite.com...] [R=301,L]

With this script, I get a "500 Internal Server Error". Also, FWIW, I tried the following simple .htaccess string:

redirect 301 /index.html [mysite.com...]

This seemed to work just fine...except when I check the header status. For the IP address it showed "301 moved permanently"...great! For the main domain (www.mydomain.com), it also showed "301 moved permanently"...not great :-)

Dave

6:03 am on June 21, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2004
posts:89
votes: 0


Justin,

I found a small syntax issue with what I had typed. Here's what I have in .htaccess now, and the results:

Options +FollowSymLinks
RewriteEngine on
# redirect all valid domain aliases to the www form
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.mysite\.com
RewriteRule ^(index\.html)?$ [mysite.com...] [R=301,L]

It does not redirect you from the IP addy to www.mysite.com in the URL bar of your browser, but it does report a "301 permanently moved" when I check the header. I wonder if that will suffice for the search engines, so they don't think my IP and domain are two different sites (trying to dodge the dupe content problem I seem to have with Y!, since they have indexed my site both ways for some reason).

Dave

10:54 pm on June 21, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 15, 2004
posts:89
votes: 0


One last post... Justin, I was wrong. The script is redirecting, and everything is working great. I forgot to clear cache before testing. The script I placed in my last message is working like a charm. Thanks to everyone who has mailed me and helped me work through this problem. Looks like my IP address and the aliased version of my domain (mysite.com vs. www.mysite.com) is now being 301 redirected to the top domain of www.mysite.com, while the ip_addy/everything_else.htm is being left alone (so my shopping cart will work fine). Just what the doctor ordered...

Now, if Y! will get me out of the dupe content penalty box, I can see how many folks use Y! for my niche market :-)

Thanks again!
Dave