Welcome to WebmasterWorld Guest from 107.20.75.63

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Google found actual scripts even though I have URL rewrite!

     
7:33 pm on Nov 20, 2010 (gmt 0)

Preferred Member

5+ Year Member

joined:July 12, 2007
posts: 362
votes: 0


We rewrite all of our URLs using mod_rewrite with htaccess.

Somehow google found the actual pages that the rewrites use, and so now there is duplicate content on every page.

Our rewrites are done in a simple way:

RewriteRule ^page/(.*).html$ /scripts/widget.php?color=$1 [L]

We checked and checked and there is no link anywhere that does not use the rewritten URLs.

Does anyone know any way this might have happened, so we can fix his? Apparently if you type in the rewritten URL into the browser, on some rare occassions it redirects you to the script URL. I've only been able to replicate this one. No idea how this happens, but this must have been how Google discovered this.

Any help is appreciated, thanks!
10:15 pm on Nov 20, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


Yes, you can set a redirect to fix this. It's one of the most popular topics in this forum. There's hundreds of prior threads with example code.

Additionally your existing code would benefit with the (.*) pattern changing to ([^.]+) or similar. It will operate a lot more quickly.
1:09 am on Nov 21, 2010 (gmt 0)

Preferred Member

5+ Year Member

joined:July 12, 2007
posts: 362
votes: 0


Thanks g1smd! Can you give me a search term to search for? I keep getting irrelevant results... thanks!
4:14 pm on Nov 22, 2010 (gmt 0)

Preferred Member

5+ Year Member

joined:July 12, 2007
posts: 362
votes: 0


Anyone know a search term? :)
11:26 pm on Nov 24, 2010 (gmt 0)

Preferred Member

5+ Year Member

joined:July 12, 2007
posts: 362
votes: 0


c'mon guys, help out a newbie :)
7:47 am on Nov 27, 2010 (gmt 0)

New User

5+ Year Member

joined:Nov 25, 2010
posts:22
votes: 0


Some good examples and detailed info on htaccess usages

[corz.org ]
10:34 pm on Dec 1, 2010 (gmt 0)

Senior Member

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

joined:Mar 31, 2002
posts:25430
votes: 0


Please see our Apache Forum Charter and our Apache Forum Library for (a lot) more info.

# Externally redirect only direct client requests for script filepath back to search-friendly URL
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /scripts/widget\.php\?color=([^&\ ]+)\ HTTP/
RewriteRule ^scripts/widget\.php$ http://www.example.com/page/%1.html? [R=301,L]
#
# Internally rewrite search-friendly widget requests to script
RewriteRule ^page/([^.]+)\.html$ /scripts/widget.php?color=$1 [L]

This code works if and only if "color" is the only query string parameter. For additional parameter support, you will need to provide more information.

Jim
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members