I’m using permalinks and I’m trying to 301 redirect my non-www url to my www url. I thought this would be a simple procudure adding some rules to my .htaccess, but it’s not. Either it screws over my permalinks or it doesn’t work at all.
Doing this yourself is generally unnecessary; WordPress handles canonical redirection automatically. If your site’s settings has the www in the site and blog url, then it will redirect to that url when another request comes in on the wrong URL.