Forum Moderators: phranque

Message Too Old, No Replies

Proper .htaccess Structure

         

andy_boyd

11:52 am on Nov 17, 2005 (gmt 0)

10+ Year Member



I'm pretty new to .htaccess, so I don't really know all the 'ins and outs' of it.

I've looked around but haven't found a clear enough answer to my question. My current .htaccess looks like this:

Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]
Redirect permanent /old.html http://www.example.com/new.html
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]

.... some more bad bots ...

RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
RewriteCond %{HTTP_USER_AGENT} ^Zeus
RewriteRule ^.* - [F,L]

Do I need to use RewriteEngine On twice, or is it ok to use it once at the top after Options +FollowSymLinks?

Thanks for you help. :)

jdMorgan

1:48 pm on Nov 17, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, only once at the top, after Options.

Jim

andy_boyd

12:15 am on Nov 19, 2005 (gmt 0)

10+ Year Member



Much appreciated JD :)