No Acces of File Type

Posted on Wednesday, October 28, 2009 in .htaccess

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

No Direct Acess of index.php

Posted on Wednesday, October 28, 2009 in .htaccess

#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.

Posted on Wednesday, October 28, 2009 in .htaccess

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

Redirect 301

Posted on Monday, October 26, 2009 in .htaccess

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

Hide File Extension

Posted on Friday, September 11, 2009 in .htaccess

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

Image 404 .htaccess

Posted on Tuesday, August 18, 2009 in .htaccess

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

Use .do Extension

Posted on Monday, July 6, 2009 in .htaccess

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