Before you start with .htaccess

If you don’t have a .htaccess file in your directory just create a simple textfile with the name .htaccess, remember to save the .htaccess file with a . dot. In Windows Notepad save as “.htaccess” (with quotes in the save dialog).

Lines starting with # indicates a comment and will note be parsed.

Prevent downloading of your SQLite database

If you place your SQLite database in a public www directory it could be downloaded by a visitor. See the SQLite quick tips for creating a SQLite database in a safer way. Add or remove file extension if needed. Place the following code in your .htaccess file.

# Deny sqlite file access. File extensions in parentheses
<FilesMatch “\.(sqlite|sqlite2|sqlite3|sq|sq2|sq3)$”>
Deny from all
</FilesMatch>

Custom error pages, “404 page not found”…

If you want to set your own error page for “404 page not found” and for other HTTP status codes you can do that easily in a .htaccess file.

ErrorDocument 404 /yourOwn404Page.html

Just replace the “404″ with the the code you need and the file that should be shown.

Disable directory browsing

If you have an image directory that shows all your files when accessing it, you can disable this by placing an .htaccess file with the following code (notice the minus sign)

# – (minus) disable browsing. + (plus) enable browsing
Options -Indexes

If you place a plus sign in front of Indexes it will list your files again. A simpler variant is just to place an index.html file in that directory, it will do the same thing. You decide :-)

Change default index page

Want to have another index page than the regular index.html, index.php page? Change the myStartPage.html in the following code and then add all other index pages you need. If myStartPage.html is not found it will try index.html and then index.php (and so on).

# reading left to right
DirectoryIndex myStartPage.html index.html index.php

ref:

Shamelessly quoted from

http://www.litewebsite.com/?k=tips

there are loads of other tips. so please visit them :D Good luck and well done for the good site

Leave a Reply

Twitter