New Sado Version 1.1 released! Easily add ORM to your applications using our Sado Library

Protected SVN Directories with HTACCESS File

This line in the ".htaccess" file will protect all SVN directories (".svn/"): <IfModule mod_rewrite.c>
      RewriteRule ^(.*/)?\.svn/ - [F,L]
</IfModule>
Read more...

Force HTTPS

#force https
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}/ [L]

No Direct Acess of index.php

#no direct access of index.php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://%{HTTP_HOST}/ [R=301,L]

Force www.

#force www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L]

Redirect 301

Redirect 301 /path/old.htm http://www.example.com/new.htm

Hide File Extension

RewriteCond %{REQUEST_URI} !^/(.*)(\.)
RewriteRule ^(.*)$ index.php?do=$1&%{QUERY_STRING} [NC,L]

Image 404 .htaccess

# img not found
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} \.(gif|jpg|jpeg|png)$            
RewriteRule .* images/spacer.gif [L]

Use .do Extension

Options -Indexes
AddType application/x-httpd-php do php
RewriteEngine On
RewriteRule ^pg.do$ index.php?%{QUERY_STRING} [L]

No Acces of File Type

Example, don't allow access to .ini files:
#no direct access of *.ini
RewriteRule ^(.*)\.ini$ http://%{HTTP_HOST}/ [R=301,L]