1

10 mod rewrite rules you should know

http://www.noupe.com/php/10-mod_rewrite-rules-you-should-know.html

http://www.noupe.com/php/10-mod_rewrite-rules-you-should-know.html

2

Url rewriting from index.html to root and some more

-

RewriteEngine on
DirectoryIndex index.php index.htm index.html

RewriteEngine on
RewriteBase /

RewriteRule (. /$) 404.php [L]

RewriteCond %{HTTP_HOST} ^site.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.site.com$
RewriteRule ^events\\.php$ \"http\\:\\/\\/www\\.site\\.com\\/events\\/\" [R=301,L]

RewriteCond %{HTTP_HOST} ^site.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.site.com$
RewriteRule ^contact\\.php$ \"http\\:\\/\\/www\\.site\\.com\\/contact\\/\" [R=301,L]

RewriteCond %{HTTP_HOST} ^site.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.site.com$
#RewriteRule ^index\\.htm$ \"http\\:\\/\\/www\\.site\\.com\\/index\\.htm\" [R=301,L]
RewriteRule ^index\\.htm$ \"http\\:\\/\\/www\\.site\\.com\\/\" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^music\\.htm$ \"http\\:\\/\\/\\/www\\.site\\.com\\/music\\/\" [R=301,L]


# Forces a trailing slash to be added
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]