Forum Moderators: phranque
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteCond %{HTTP_HOST} ^example.net$ [NC]
RewriteCond %{HTTP_HOST} ^www.example.net$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L] RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.example.com/$1/ [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L] DirectorySlash directive should take of the other problem.
RewriteBase /
Remove ^ and $
The DirectorySlash directive should take of the other problem.
Awk! Leave off the first condition.
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L] do I need a condition that sends example.com to www.example.com?
"If the hostname is anything other than exactly such-and-such or exactly nothing".