Jump to content

Recommended Posts

Posted (edited)

I just need to clarify that the [L] at the end of a RewriteRule means the end.........of what? Does it need to be the very last thing in htaccess? Or does it matter?

 

 

>order allow, deny
deny from 1**.***.**.**1
deny from 2**.***.**.**2
allow from all

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^grabber1 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^grabber2 [NC]
RewriteRule .* - [F]

RewriteCond %{HTTP_REFERER} (spamproduct1) [NC,OR]
RewriteCond %{HTTP_REFERER} (spamproduct2) [NC]
RewriteRule .* - [F]

RewriteCond %{HTTP_REFERER} (badsite\.info) [NC,OR]
RewriteCond %{HTTP_REFERER} (baddersite\.com) [NC]
RewriteRule .* - sorry-dude.php [L]

Redirect permanent /hints.html http://mysite.com/home.html

 

The above is severely edited but the format is correct? I can keep adding conditions as long as the [L] is at the end?

 

I'm sure you can tell I'm a little confused, I can't even phrase the question intelligently. :yes:

 

As always, thanks.

Edited by boxturt
Posted (edited)

Hello,

 

Correct, [L] must go at the very end of everything, its the last rule of the REWRITE engine. You can place other bits afterwords, just as long as its nothing to do with REWRITE.

 

Other then that, it all looks healthy!

 

Jimuni

Edited by Jimuni
Posted

'last|L' (last rule)

Stop the rewriting process here and don't apply any more rewriting rules. Use this flag to prevent the currently rewritten URL from being rewritten further by following rules. For example, use it to rewrite the root-path URL ('/') to a real one, e.g., '/e/www/'.

 

You can have more than one [L] in your htaccess. It just means the end of that rule for that specific purpose.

Posted

Hmmmm............ so I can have but don't need to have? This is where I get lost. I did have [L] after each RewriteRule but it seems to stop reading at that first one, eg:

 

>RewriteEngine On
RewriteCond %{HTTP_REFERER} (spamproduct1) [NC,OR]
RewriteCond %{HTTP_REFERER} (spamproduct2) [NC]
RewriteRule .* - [F,L]

RewriteCond %{HTTP_USER_AGENT} ^grabber1 [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^grabber2 [NC]
RewriteRule .* - [F,L]

RewriteCond %{HTTP_REFERER} (badsite\.info) [NC,OR]
RewriteCond %{HTTP_REFERER} (baddersite\.com) [NC]
RewriteRule .* - sorry-dude.php [L]

 

 

 

So it doesn't seem to get past the first rule, and what seems to have happenned is the rules for denying grabber bots are getting ignored. So 30,000 hits later......... :yes:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...