Home > Config > Apache Cheat Sheet

Apache Cheat Sheet

September 29th, 2006 KaiJern

Got these stuff from , http://www.petefreitag.com/cheatsheets/apache/

How To Cheat :

Add a directory index

DirectoryIndex index.cfm index.cfm

Turn off directory browsing

Options -Indexes

Create a new user for basic auth (command line)

htpasswd -c /etc/apacheusers

Apache basic authentication

AuthName “Authentication Required” AuthType Basic AuthUserFile /etc/apacheusers Require valid-user

Only allow access from a specific IP

Order Deny,Allow Deny from all Allow from 127.0.0.1

Only allow access from your subnet

Order Deny,Allow Deny from all Allow from 176.16.0.0/16mod_rewrite

Turn on the rewrite engine

RewriteEngine On

Redirect /news/123 to /news.cfm?id=123

RewriteRule ^/news/([0-9]+)$ /news.cfm?id=$1 [PT,L]

Redirect www.example.com to example.com

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

Categories: Config Tags:
Comments are closed.