Forum Moderators: phranque

Message Too Old, No Replies

Base .htaccess file for an extentionless website

Starting point for a new .htaccess file

         

jd01

12:53 am on Jan 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<IfModule mod_php4.c>
php_flag magic_quotes_gpc off
php_flag register_globals off
php_flag allow_url_fopen none
</IfModule>

errordocument 404 /error.php
errordocument 410 /error.php

Options -Indexes +FollowSymLinks

RewriteEngine on
RewriteRule \.htaccess - [F]

RewriteCond %{THE_REQUEST} \?
RewriteRule .? http://www.example.com%{REQUEST_URI}? [R=301,L]

RewriteCond %{THE_REQUEST} /([a-z/-]+)\.
RewriteRule . http://www.example.com/%1 [R=301,L]

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /?http:// [NC]
RewriteCond %{THE_REQUEST} !^(GET¦HEAD¦POST¦OPTIONS¦PROPFIND¦TRACE)\ /?http://([^.]+\.)?example\.com/
RewriteRule .? - [G]

RewriteRule ^([a-z/-]+)?$ /script.php?url=$1 [L]

RewriteCond %{HTTP_USER_AGENT} ^User-Agent-Blocking [OR]
RewriteCond %{HTTP_USER_AGENT} Robot¦abot [NC]
RewriteRule .? - [G]

Just sort of a 'standard set' of rules I usually use to start new files.

Justin

Added: Some sets can be combined and/or edited, just wanted to give some ideas that might be important to site structure and function.