I’ve been trying to work on my htaccess file for one of my other domains feverishthoughts.com for a few weeks. What I’d like is for the main website on feverishthoughts to have www in the url but ever new htaccess code that I’ve tried seems to fail and worse often ends up messing up how my site works.
I’m so frustrated I could start throwing folding chairs, and other things around!
I mentioned my problem in a forum and wrote a post about it on my main blog and some people have been very nice and offered up codes to try but nothing is working.
If anyone reading this post has an htaccess code for me to try that will put www in all the urls for my main blog even if they came to the site using a link without the www I’d appreciate it.
I wonder if part of the problem is that this domain thewebfiles.com is the main domain on my server?
Imagex says
You might also want to set up redirects from the www. to the non www or vice versa so that you get a compounding effect from incoming links, because search engines treat the 2 url versions differently, but the redirect combines the link love.
Jan London says
How about this one?
Options FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
The first line isn’t necessary. This code works for all of my domains perfectly.
philip says
@jan –
Thanks for that, but there is a typo in there:
the last line should have a dollar sign before the numeral 1 e.g.
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Thanks, tho