: Using Mod_Rewrite To Block Referrer Based On Domain Extenstion? 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
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.
More posts by @Pierce454
1 Comments
Sorted by latest first Latest Oldest Best
Sure. The right hand expression of the RewriteCond is simply a regular expression. The correct regular expression for matching anything ending in ".com" is:
.com$
The $ means "end of string".
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.