Forum Moderators: phranque

Message Too Old, No Replies

Losing inbound links because people can't code

         

internetheaven

9:34 am on May 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There must be at least 100+ links pointing to my site that are coded with the same error. People uploading them to a CMS they bought that adjusts the coding directly. The links now look like this:

http://www.example.com">Example.com
http://www.example.com/index.php">Click
or
http://www.example.com/index.php?page=1">Visit

the first two generate a 404 error from my site. But for some reason www.example.com/index.php?page=1 shows up just fine even though there is the ">Visit attached to the end of the query string.

I've tried contacting the webmasters but have had no joy on most occasions. Does anyone know how to make:

http://www.example.com">Example.com
http://www.example.com/index.php">Click
http://www.example.com/index.php?page=1">Visit

301 to:

http://www.example.com
http://www.example.com/index.php
http://www.example.com/index.php?page=1

Any assistance would be appreciated.
Thanks
Mike

Receptional Andy

2:35 pm on May 10, 2008 (gmt 0)



The first example I'm not sure you can fix, since without the trailing slash, the browser likely thinks that the doublequote and the rest are part of the domain name.

In any case, you could probably try a generic rule, assuming you don't have any genuine URLs with quotes in them:

RewriteRule ^(.*)" $1 [R=301,L]

You'll need something a bit more complex for the URLs with query strings, I imagine. And i'm sure someone else can recommend a tidier/more efficient rule than mine!

jdMorgan

5:54 pm on May 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You may need to escape that quote character, though:

RewriteRule ^([^\"]+)\" http://www.example.com/$1 [R=301,L]

Jim

g1smd

6:33 pm on May 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



if the query string value is always digits then you can easily strip anything after those digits off. That's a fairly easy test and fix.