Post Reply  Post Thread 
Apache configuration tips
Author Message
admin
~CM~
*******


Posts: 147
Group: Administrators
Joined: Jul 2007
Status: Offline
Reputation: 0
Thank 0
1 was given thank in 1 posts
Post: #1
Apache configuration tips

Enable Directory Browsing

Quote:
Options +Indexes## block a few types of files from showingIndexIgnore *.wmv *.mp4 *.avi


Disable Directory Browsing

Quote:
Options All -Indexes


Customize Error Messages

Quote:
ErrorDocument 403 /forbidden.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /servererror.html


Get SSI working with HTML/SHTML

Quote:
AddType text/html .html
AddType text/html .shtml
AddHandler server-parsed .html
AddHandler server-parsed .shtml
# AddHandler server-parsed .htm


Change Default Page (order is followed!)

Quote:
DirectoryIndex myhome.htm index.htm index.php


Block Users from accessing the site

Quote:
order deny,allowdeny from 211.54.122.76
deny from 81.70.44.55
deny from .spammers.com
allow from all


Allow only LAN users

Quote:
order deny,
allowdeny from all
allow from 192.168.0.0/24


Redirect Visitors to New Page/Directory

Quote:


Block site from specific referrers

Quote:
RewriteEngine on
RewriteCond %{HTTP_REFERER} sitetoblock.com
RewriteCond %{HTTP_REFERER} sitetoblock-2.com
RewriteRule .* - [F]


Block Hot Linking/Bandwidth hogging

Quote:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.*$ RewriteRule .(gif|jpg)$ - [F]


Want to show a “Stealing is Bad” message too?

Add this below the Hot Link Blocking code:

Quote:
RewriteRule .(gif|jpg)$ http://www.mydomain.com/dontsteal.gif [R,L]


Stop .htaccess (or any other file) from being viewed

Quote:
order allow,denydeny from all


Avoid the 500 Error

Quote:
# Avoid 500 error by passing charsetAddDefaultCharset utf-8


Grant CGI Access in a directory

Quote:
Options +ExecCGIAddHandler cgi-script cgi pl#


To enable all scripts in a directory use the following

Quote:
# SetHandler cgi-script


Change Script Extensions

Quote:
AddType application/x-httpd-php .gne

gne will now be treated as PHP files! Similarly, x-httpd-cgi for CGI files, etc.

Use MD5 Digests

Performance may take a hit but if thats not a problem, this is a nice option to turn on.

Quote:
ContentDigest On


Save Bandwidth
# Only if you use PHP

Quote:
php_value zlib.output_compression 16386


Turn off magic_quotes_gpc
# Only if you use PHP

Quote:
php_flag magic_quotes_gpc off


Thanks & Regards
------------------
~CM~

ADD TO DEL.ICIO.US  ADD TO DIGG  ADD TO FURL  ADD TO NEWSVINE  ADD TO NETSCAPE 
ADD TO TECHNORATI FAVORITES  Technorati ADD TO SQUIDOO  ADD TO WINDOWS LIVE  ADD TO YAHOO MYWEB  ADD TO ASK 
ADD TO REDDIT  ADD TO STUMBLEUPON  ADD TO GOOGLE   

07-25-2007 03:09 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Apache authentication using .htaccess admin 0 190 07-24-2007 06:32 PM
Last Post: admin
  Speed up downloads for Apache Nilesh 0 217 07-15-2007 10:05 AM
Last Post: Nilesh

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: