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

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

Apache Web Server Forum

    
How to ignore specific http requests from google..
mod_rewrite a solution?
vortexer




msg:1499932
 11:25 am on Dec 3, 2002 (gmt 0)

anyone here know how I may block all incoming http request where the referring url has the characters "sex" in it? It appears google picked up on three articles with the word sex and a combination of a specific ethnicity in it and I am getting way too many perverts signing up for free account on my site..assuming they'll get wonderstash upon signup.. (it's a literary content site) ..this is affecting my demographics.last month 70% of hits were sex related ..

I was told I can do this with Rewrite rules on http referrer.. but am not sure how to go about it..

so any help is appreciated..please!

 

DaveAtIFG




msg:1499933
 5:40 pm on Dec 3, 2002 (gmt 0)

Welcome to WebmasterWorld vortexer!

If you're using an Apache server, mod_rewrite will do what you want. We have several experts that are VERY generous in helping members sort out problems. But WebmasterWorld prefers to HELP, not "do it for you."

So where to begin? At the top of your screen is a link to "site search" that will help you find numerous mod_rewrite discussions on this board.

To help you understand those discussions and use mod_rewrite effectively, you'll need to be familiar with regular expressions. This Regular Expressions Tutorial [etext.lib.virginia.edu] is a good place to start. Here's a link to the official
Apache mod_rewrite Reference docs [httpd.apache.org] and the Apache mod_rewrite Guide [httpd.apache.org] offers many "real world" examples of mod_rewrite in use.

From the mod_rewrite guide:
The Apache module mod_rewrite is a killer one, i.e. it is a really sophisticated module which provides a powerful way to do URL manipulations. With it you can nearly do all types of URL manipulations you ever dreamed about. The price you have to pay is to accept complexity, because mod_rewrite's major drawback is that it is not easy to understand and use for the beginner.

Don't get discouraged! :)

vortexer




msg:1499934
 11:49 pm on Dec 3, 2002 (gmt 0)

I managed to get it working as:

RewriteCond %{HTTP_REFERER} ^.*sex.* [OR]
RewriteCond %{HTTP_REFERER} ^.*porn.*
RewriteRule /* [disney.com...]

DaveAtIFG




msg:1499935
 1:35 am on Dec 4, 2002 (gmt 0)

Nice work! :)

jdMorgan




msg:1499936
 5:48 am on Dec 4, 2002 (gmt 0)

LOL! - Love that forward to Di$ney!

You can speed this up a bit, if you like:

RewriteCond %{HTTP_REFERER} (sex¦porn)
RewriteRule /* [disney.com...] [R=301,L]

Since you wanted to catch either of those words occurring anywhere in the referral string, you don't need start "^" or end "$" anchors on your patterns. Plus, you can OR them together under one RewriteCond to speed things up. The R=301 makes this a permanent redirect, and the L means don't bother to process any more RewriteRules, because you're booting them out to di$ney right now.

Note: You may have to edit that "¦" character. Use the one on your keyboard to replace it.

Still chuckling...

Jim

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