Syntax for .htaccess files

hi folks-

in dealing with referrer spam, i’m trying to optimize my .htaccess file. couldn’t find an answer to this anywhere.

to deal with subdomains, can i use this syntax:

RewriteCond %{HTTP_REFERER} ^http://(www.)?$ [NC,OR]

or do i need to have the entire subdomain listed, like so:

RewriteCond %{HTTP_REFERER} ^http://(www.)?*$ [NC,OR]

couldn’t find this anywhere (weirdly). thanks!



Don’t forget to put a \ in front of periods you need to match on, and I’m not sure you are using the asterisk correctly.

Try ^http://.*

This should match any referrers that start with ‘http://’, then have a string of characters (or none), then ‘’

Regular expression syntax can be found at

And there is also

:cool: Perl / MySQL / HTML+CSS

right on. thanks.