Hypography Science Forums: htaccess - Hypography Science Forums

Jump to content

Welcome! You are currently viewing the Hypography Science Forum as a guest. In order to participate in our science discussions, you should register now! Registration is free and you can use your Facebook login if you like.
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

htaccess Rate Topic: -----

#1 User is offline   Cedars 

  • Creating
  • Group: Members
  • Posts: 1,809
  • Joined: 26-June 05

Posted 05 May 2007 - 07:47 AM

When adding rewriteCond covering three different aspects do I have to start each with the :

RewriteEngine on

example:
1st instruction
# RewriteEngine on
# RewriteCond %{HTTP_REFERER} !^$
# Blah
# blah
# blah
# RewriteRule .*.(gif|GIF|jpg|JPG|bmp|BMP|wav|mp3|wmv|avi|mpeg)$ - [F]

2nd instruction:

# RewriteEngine on
# RewriteCond %{HTTP_REFERER} nasty.com [NC,OR]
# Blah
# blah
# RewriteRule .* - [F]

3rd instruction:

# RewriteEngine On
# RewriteCond %{HTTP_USER_AGENT} ^BadBot [OR]
# RewriteCond %{HTTP_USER_AGENT} ^AnotherBadBot [OR]
# Blah
# blah
# RewriteRule ^.* - [F,L]

Do I leave off the second and third Rewrite Engine On part
or Does htaccess need each rewrite on to initiate the separate commands?
or
Leave it on each , it wont affect how htaccess is handled?
0

#2 User is offline   Tormod 

  • Hypographer
  • View gallery
  • Group: Administrators
  • Posts: 14,084
  • Joined: 11-February 02
  • LocationOslo, Norway

Posted 05 May 2007 - 07:48 AM

RewriteEngine On is only required once.
:) Your Friendly Neighborhood Administrator - Please help us by reporting bugs and problems via our Bug Tracker!

Please try out our new Creativity Forums! Log in with your Science Forums credentials.

Science is not only compatible with spirituality; it is a profound source of spirituality.
- Carl Sagan
0

#3 User is offline   Cedars 

  • Creating
  • Group: Members
  • Posts: 1,809
  • Joined: 26-June 05

Posted 05 May 2007 - 07:49 AM

Tormod said:

RewriteEngine On is only required once.


Wow, that was fast!
Thank you!
0

#4 User is offline   Tormod 

  • Hypographer
  • View gallery
  • Group: Administrators
  • Posts: 14,084
  • Joined: 11-February 02
  • LocationOslo, Norway

Posted 05 May 2007 - 07:52 AM

You're welcome! :shrug:

There are tons of good tutorials out there. I've struggled enough with rewriteengine to know that it can be daunting to get it to do what you want sometimes.

Here's one:
Module Rewrite - URL Rewriting guide.

For more, simply google "rewriteengine tutorial".
:) Your Friendly Neighborhood Administrator - Please help us by reporting bugs and problems via our Bug Tracker!

Please try out our new Creativity Forums! Log in with your Science Forums credentials.

Science is not only compatible with spirituality; it is a profound source of spirituality.
- Carl Sagan
0

#5 User is offline   Cedars 

  • Creating
  • Group: Members
  • Posts: 1,809
  • Joined: 26-June 05

Posted 08 May 2007 - 07:23 AM

And there are a bunch of bad! tutorials out there.

I managed to block everyone from the website (not sure if it was wildcards or escape) Fixed now.

Screwed up the No-Hot-Linking (fixed now)

Managed to block image linking within the website (fixed now).

Thought my head was gonna explode for a while there, but I am better now.
0

#6 User is offline   Cedars 

  • Creating
  • Group: Members
  • Posts: 1,809
  • Joined: 26-June 05

Posted 16 November 2007 - 08:31 AM

OK I have a spammer. I dug up info and managed to get my htaccess to block the creep sometimes. My question is how to use wildcards in this piece so I can block more:

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


as you can see, what he is doing is changing from airlinetickets.com to airline333tickets.com, to airline279.com, etc. He is doing with with others also.

Is is something like http(s)?://(www.)?airline{*}tickets.com?

Thanks !
0

#7 User is offline   Tormod 

  • Hypographer
  • View gallery
  • Group: Administrators
  • Posts: 14,084
  • Joined: 11-February 02
  • LocationOslo, Norway

Posted 16 November 2007 - 09:56 AM

Keep it simple...deny all airlines... :graduate:

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www.)?.*(-|.)?airline(-|.).*$ [OR]
RewriteRule .* - [F]


Not tested, just guessing, really.
:) Your Friendly Neighborhood Administrator - Please help us by reporting bugs and problems via our Bug Tracker!

Please try out our new Creativity Forums! Log in with your Science Forums credentials.

Science is not only compatible with spirituality; it is a profound source of spirituality.
- Carl Sagan
1

#8 User is offline   alexander 

  • Dedicated Smart-ass
  • View gallery
  • Group: Moderators
  • Posts: 5,656
  • Joined: 04-May 04

Posted 16 November 2007 - 12:09 PM

lol i thought i had one bad on this lamp box i put up on my company network... and then after thinking about it i was duhing myself.... it was a firewall rule... i was like ooooops, i meant to allow traffic to port 80, not deny it :graduate:
~ Sun, number 1 cause of global warming.


Caution: some thinking required when using this product, keep your axons and dendrites inside your head at all times.
0

#9 User is offline   Cedars 

  • Creating
  • Group: Members
  • Posts: 1,809
  • Joined: 26-June 05

Posted 21 November 2007 - 04:01 AM

Tormod said:

Keep it simple...deny all airlines... :)

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://(www.)?.*(-|.)?airline(-|.).*$ [OR]
RewriteRule .* - [F]


Not tested, just guessing, really.


The * in the referer name gave me a 500 internal error.

the adjustments I tried did not block *airline. I didnt try every combo possible, may work on that later this week. But its been over 2 full days now and the spammer has been getting 403'd when he tries to get in after I added a few name combos proactively.

htaccess is pretty cool!
0

#10 User is offline   Tormod 

  • Hypographer
  • View gallery
  • Group: Administrators
  • Posts: 14,084
  • Joined: 11-February 02
  • LocationOslo, Norway

Posted 25 November 2007 - 11:36 PM

If you find the solution in the end please let us know. Always nice to learn something new. :)
:) Your Friendly Neighborhood Administrator - Please help us by reporting bugs and problems via our Bug Tracker!

Please try out our new Creativity Forums! Log in with your Science Forums credentials.

Science is not only compatible with spirituality; it is a profound source of spirituality.
- Carl Sagan
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


View our Science Quizzes | Science links. About the Hypography Science Forums

Friends

We recommend these stellar sites:

PC Help Forum

ATL - Atlanta Computer Repair

Sponsors

Hypography?

Hypography [n.]: A combination of "hyperlink" and "bibliography" - ie, a list of links to electronic documents. Comparable to discography and bibliography, but not cartography.

When we launched in May 2000, we wanted to create a site to share science-related content of all kinds on the web. As time passed, our site turned into a pure science forum with lots of cool people.

So we kept the name Hypography and the cool science forum community - and aim to be a friendly place for discussion of science topics of all kinds.