syntax for .htaccess files

syntax for .htaccess files

Posted by: patricking
Posted on: 2005-02-05 14:32:00

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.)?*.domain.com*$ [NC,OR]

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

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

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

yours,

/pk

Re: syntax for .htaccess files

Posted by: Atropos7
Posted on: 2005-02-05 15:59:00

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://.*.domain.com

This should match any referrers that start with 'http://', then have a string of characters (or none), then '.domain.com'

Regular expression syntax can be found at http://www.perl.com/doc/manual/html/pod/perlre.html

And there is also http://httpd.apache.org/docs/misc/rewriteguide.html


cool Perl / MySQL / HTML+CSS

Re: syntax for .htaccess files

Posted by: patricking
Posted on: 2005-02-05 23:43:00

right on. thanks.

yours,

/pk

Tags: htaccess fileswww domainhtaccess filesubdomainsyntaxhi folkssubdomainsoptimizespamhttp