Using Mod_Rewrite To Block Referrer Based On Domain Extenstion?

Posted by Matt on Pro Webmasters See other posts from Pro Webmasters or by Matt
Published on 2014-05-03T06:29:44Z Indexed on 2014/06/02 16:01 UTC
Read the original article Hit count: 209

Filed under:

I've been in web development for several years now (I'm a student web designer), and recently, I've begun to experiment with mod_rewrite for things like URL shortening.

I was wondering, is it possible to block a referrer by domain extension, instead of just by full site, etc.?

So, instead of

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} examplesite\.com [NC]
RewriteRule .* - [F]

could you do

RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} \.com [NC]
RewriteRule .* - [F]

without the full domain name?

Thanks. I'm fairly knowledgeable about other web dev / hosting topics, but mod_rewrite is new to me and Google wasn't helping.

© Pro Webmasters or respective owner

Related posts about mod-rewrite