homepage Welcome to WebmasterWorld Guest from 23.22.59.252
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
alika

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4575729 posted 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:


www.URL.com/category/page/196?nomobile
www.URL.com/category/page/197?nomobile
www.URL.com/category/page/198?nomobile
www.URL.com/category/page/199?nomobile
www.URL.com/category/page/200?nomobile
www.URL.com/category/page/201?nomobile
www.URL.com/category/page/202?nomobile
www.URL.com/category/page/203?nomobile
www.URL.com/category/page/204?nomobile


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

Thanks

 

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4575729 posted 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 ;))

alika

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4575729 posted 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

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4575729 posted 8:56 pm on May 20, 2013 (gmt 0)

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

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4575729 posted 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 :)

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 4575729 posted 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