Forum Moderators: phranque
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*)$ http://www.example.com/$1 [R=301,L]
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ seo.php?menuname=$1
RewriteCond %{THE_REQUEST} ^.*/home.php
RewriteRule ^(.*)home.php$ http://www.example.com/$1 [R=301,L]
[edited by: jdMorgan at 1:38 pm (utc) on May 7, 2010]
[edit reason] Please use example.com only. See Terms of Service and forum Charter. [/edit]
RewriteEngine on
#
# Externally redirect direct client requests for "home.php" in any directory to "/" in that same directory
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /([^/]+/)*home\.php([?#][^\ ]*)?\ HTTP/
RewriteRule ^(([^/]+/)*)home\.php$ http://www.example.com/$1 [R=301,L]
#
# Externally redirect requests for non-blank non-canonical hostnames to canonical hostname
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
#
# Internally rewrite all requests for .html URL-paths to "seo.php" script
RewriteRule ^([a-z0-9_-]+)\.html$ seo.php?menuname=$1 [NC,L]
example.com/seo.php?menuname=<something> and therefore prevent Duplicate Content issues, you can prefix the whole lot with: # Prevent direct access via dynamic URLs
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*seo\.php\?menuname=([^\ ]+)\ HTTP/
RewriteRule ^([^/]+/)*seo\.php$ http://www.example.com/%1.html [R=301,L]