Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

How to ignore specific http requests from google..

mod_rewrite a solution?



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

10+ Year Member

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!


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

WebmasterWorld Senior Member 10+ Year Member

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! :)


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

10+ Year Member

I managed to get it working as:

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


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

WebmasterWorld Senior Member 10+ Year Member

Nice work! :)


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

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

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...



Featured Threads

Hot Threads This Week

Hot Threads This Month