WordPress .htaccess www. not forcing

Solution:

Go Settings -> General: WordPress Address (URL) Site Address (URL)

And set both of them to www.yoursite.com (instead of yoursite.com), wordpress automagically takes care for setting all the urls to www.yoursite.com and that’s it.

If that isn’t enough, you shouldn’t edit the .htaccess file anyway, because anytime you save or reload your permalink settings, WordPress will overwrite your .htaccesss (some plugins may do that as well).

If you do want to rewrite your URL, you should do it with WP Rewrite (Codex), or if you want a little more simple approach, there is a good plugin for that called Redirection (WordPress.org Plugin Directory).

In Redirection plugin you can just set the options to *.mydomain.com/* to redirect to www.mydomain.com/* with a 301, and that will take care of your htaccess as long as you keep the plugin active.

Hope this helps 🙂