Forum Moderators: phranque
thanks.
------- .htaccess Code -----------
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
Is w.yoursite.com resolving to anything?
The only way i see this hapening is if you have a subdomain named "w" but I don't even know if this is possible.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Do not end-anchor the domain name pattern in the RewriteCond unless you add "(:80)?$" or "(:[0-9]{1,5})?$" to the end of the pattern. Otherwise your rule will fail if a user or proxy appends a port number to the domain (It is perfectly valid to do so).
[added] Neither this code nor the code you posted above will "add a trailing slash" to your domain name. However, if UseCanonicalName is set to "on" in your server config file, and if the server name or DocumentRoot is misconfigured (with a trailing slash on it), then it might appear to do so. [/added]
Jim