Forum Moderators: phranque
http://www.example.com/?=DSL
http://www.example.com/?=BED
I tried creating a 404 page but was not able to do so using Front Page. The next thing I tried is to use a robots.txt file to Disallow: /?
I need some help. any suggestions would be greatly appreciated. thanks! Chris.
[edited by: jdMorgan at 2:27 pm (utc) on Sep. 28, 2006]
[edit reason] Examplified. NO URLs, please. See TOS. [/edit]
Jim
RewriteCond %{QUERY_STRING} &?=DSL=[^&]* [NC]
RewriteRule ^?=DSL\.asp$ http://www.example.com/404.asp [R=404,L]
RewriteCond %{QUERY_STRING} &?=BED=[^&]* [NC]
RewriteRule ^?=Bed\.asp$ http://www.example.com/404.asp [R=404,L]
[edited by: jdMorgan at 11:43 pm (utc) on Sep. 28, 2006]
[edit reason] Example.com [/edit]
A 404 is not a good solution. Instead, you want to "repair" the requested URL and 301-redirect it to the correct URL. This will both remove the bad URL from search results, and capture the search traffic until the bad URLs are removed from search results.
Jim
As stated in my first response, the solution in the thread I cited was functionally very close to what you need:
http://www.example.com/?=DSL -- 301 --> http://www.example.com/
http://www.example.com/?=BED -- 301 --> http://www.example.com/
Options +FollowSymLinks
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^=[A-Z]{3,}
RewriteRule ^$ http://www.example.com/? [R=301,L]
This tells Yahoo! (and the other SEs) to drop the bogus URLs they are requesting, and replace them with the correct URL. Any links to the bogus URL will now be credited to the correct URL. Anyone clicking on a bogus URL on Yahoo! or anywhere else will now be delivered to the correct URL.
Note that the code is very specific -- I will work exactly and only as I described it, and you may need to modify it if my description does not encompass all of the URL corrections you need.
The first line may not be needed. It can cause an error if needed and missing, or if not needed and present.
If you already have other working rewriterules in your .htaccess file, neither of the first two lines will be required.
For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].
Jim