Forum Moderators: phranque

Message Too Old, No Replies

Tried something with an .htaccess - need guidance

.htaccess \#

         

wideaware

12:44 pm on Jan 22, 2007 (gmt 0)

10+ Year Member



I had this in my code (among other stuff)

SetEnvIfNoCase Referer ".*(jewelrycollection¦alexandr.org¦-trx.com¦jangastro¦grendosac¦fuflo999¦atspace.biz).*" BadReferrer=yes

I noticed that a little referrer spam that passed through always ended with a ht tp://w ww.dom ain.com/#

So I added a "\#" to my code so that it becomes

SetEnvIfNoCase Referer ".*(jewelrycollection¦alexandr.org¦\#¦-trx.com¦jangastro¦grendosac¦fuflo999¦atspace.biz).*" BadReferrer=yes

Will this work, or create problems? So far, the site seems to be working, but I don't want to crash it. I'll take it out, if its something really terrible.

jdMorgan

3:19 pm on Jan 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The best way to find out is to test it. Only you can do that, because depending on your server configuration --or rather, mis-configuration-- *any* code could "do something terrible." No-one here can guarantee that your code will run on your server; Any one of us could say "It's fine," but why should you believe us, when you can and should test it yourself?

Simply make a backup of your original .htaccess file. Then upload your new file at whatever time of day your site gets the least amount of traffic, and test the code by constructing a few "referrer" pages that meet the reuqirements of your SetEnvIf "filter." If the code knocks your server offline, then immediately reinstate the backup file. Even with the worst code, your server might be offline for less than a minute, as long as you are ready to reinstate the backup at the first sign of trouble.

Jim

wilderness

3:40 pm on Jan 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



SetEnvIfNoCase Referer ".*(jewelrycollection¦alexandr.org¦-trx.com¦jangastro¦grendosac¦fuflo999¦atspace.biz).*" BadReferrer=yes

This is a bit of overkill and redundant as well, which will cause you some problems.

It reads:

IF contains and then exactly as with the leading no case.

The no case and the excatly as are in conflict.

IF contains
No leading ^ or ending $
exactly as
contained in quotes

On to your actual UA's:
I've never used the .* beginning and ending that you have, neither am I aware of it's purpose/correct syntax in this module.

I really think that you could shorten these UA's with some thought.
1) the domain extensions are overkill.
2) as is the leading dash-hyphen.

(Please note; for others not using "exactly as", many characters require escaping.)

Please note; the forum converts the pipe character to broken lines and require correction before actual use.

"KISS"

Don