htaccess is the default name for a file that is used to indicate
who can or cannot access the contents of a specific file directory from the Internet or an
intranet. The .htaccess file is a configuration file that resides in a directory and
indicates which users or groups of users can be allowed access to the files
contained in that directory.It may also contain some rewrite rules which say
the server to access a page in it if the URL on the browser address bar satisfies
any of the rewrite rules on .htaccess file. A sample .htaccess file
all requests to whatever.htm will be sent to whatever.php:
DirectoryIndex index.php
order allow,deny
deny from all
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [NC]
Lets rewrite our Example URLs the .htaccess file content will be like this
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.htm$ $1.php [NC]
RewriteRule ^topics/(.+)/([0-9]+)/(.+)/([0-9]+)/$ http://%{SERVER_NAME}/index.php?sec=$2&id=$4 [nc]
Here the SEO URL
http://www.culblog.com/topics/seo-techniques/4/generate-seo-friendly-url/23
will be rewrited to
http://www.culblog.com/index.php?sec=4&id=23
http://culblog.com/index.php?sec=2&id=5