homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Need Help in Creating htaccess Rule

 12:19 pm on May 20, 2013 (gmt 0)

Our 404s in GWT has spiked in the last couple of months, and Google has been seeing hundreds of errors of this kind:


Instead of writing 500+ redirects in my .htaccess file, I think this can be handled by writing a redirect rule. Unfortunately, I don't know how to write rules in htaccess files. I want these 404s as GWT reports to be gone and instead redirect to www.URL.com/category

I'd greatly appreciate it if someone could help me craft the rewrite rules for the above




 4:09 pm on May 20, 2013 (gmt 0)

It can certainly be done with a single RewriteRule with a RewriteCond looking at %{QUERY_STRING}. But you haven't given enough information. Do you want to exclude all requests with the "nomobile" parameter? Do these requests ever include other parameters that you need to keep? Do some values of "nomobile" have meaning?

If it's purely a garbage parameter, Option B is to go into gwt and tell it to either ignore the parameter or ignore all URLs containing the parameter. (Careful! That's two different processes.)

You've been around long enough to know that we don't approve of writing rules for people to cut and paste. But if you post your best effort, someone will explain what's wrong with it so you can learn how to do it yourself. (Yes, this takes much longer than just doing it for you. It's the same principle as forcing your children to clean their own rooms-- including the stuff under the bed-- instead of just doing it yourself ;))


 4:18 pm on May 20, 2013 (gmt 0)

I think I'll just go with the GWT option (I'd rather not tinker with redirects)

I've set it to NO URLs so Google doesn't have to crawl these URLs because they don't really exist


 8:56 pm on May 20, 2013 (gmt 0)

any requested url that gets a 200 OK response "exists".


 9:17 pm on May 20, 2013 (gmt 0)

any requested url that gets a 200 OK response "exists".

The OP said they're getting 404s, so these really don't exist. If nobody but google is asking for them, the gwt solution is definitely easiest :)


 8:28 am on May 21, 2013 (gmt 0)

OP said they're getting 404s

sorry for my irrelevant answer - i don't always read the entire thread when i'm on a mobile device and thought i was answering a different thread.

i agree with lucy24 - if those urls are good without the query string and only googlebot is requesting them, use the GWT ignore parameter option.
if you are getting direct (human) visitors or referred traffic for those urls, you'll want to implement a redirect.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved