Common .htaccess issues.

Deny All, allow some.
Every IP address NOT listed here is blocked.
Order deny,allow
Deny from all
Allow from 12.34.56.78 # nobody but this ip is allowed.
Permit all, block some.
Allows users not within ip addresses listed. Every IP address listed here is blocked.
Order allow,deny
Allow from all
Deny from 12.34.56.78 # everyone but this ip is blocked.
Clean URL's
Allows you to create your own clean URL's like /path/to/content/ rather then index.php?id=31. I'd look into $_SERVER['REQUEST_URI'] for PHP on how to deal with uri's and such. This is the same method [http://www.wordpress.org/ Wordpress.org] uses in it's wordpress software for permanent links.
RewriteEngine On
RewriteBase / # Where does the installation reside? domain.com/ is different from domain.com/folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Easy Redirects
Quick rundown: Redirect 301
Nothing else, easy peasy. You can have as many as you need, there is an ordering presence you need to abide by, if i needed to forward /blog/1 and /blog/ /blog/1/ MUST come first in line.
Redirect 301 /blog/ http://domain.com/Blog/
Move www to non-www Moves people fromwww.domain.comto domain.com quickly.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.org$ [NC]
RewriteRule ^(.*)$ http://example.org/$1 [L,R=301]

 

Print