I needed a non-www to www redirect script that did not add a trailing slash. The scripts you generally find around on the internet add a trailing slash but my CMS has problems with this.
Then I found this nice little script that does not even require a domain name:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.*
RewriteRule (.*) http://www.%{HTTP_HOST}$1 [R=301,L]
Problem is, it tried to redirect my subdomain urls to www, wich of course broke the site.
Does anyone understand this language enough to make this script skip subdomain urls (like test.example.com )
It’s finally working properly, thx for sharing your expertise!
If more people ask for this piece of code you migth want to add it to the Search Engine Optimization FAQ thread. (thats where I got my old code)