Support » Fixing WordPress » 301 redirect and permalinks

  • Resolved DotsConnected


    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.

    Does anyone have a solution for this?


Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Kathryn


    First, be sure to put the www/non-www rules completely above and outside the standard WordPress permalinks block of code.

    This is what I use:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^
    RewriteRule (.*)$1 [R=301,L]

    If it doesn’t work, try contacting your host or looking in their documentation, as some hosts require different syntax.

    Thanks for taking the time to reply! I contacted my host because your solution still resulted in a 404 error when using the non-www url. I’m gonna see what they have to say and report back. 🙂

    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.

    I’m afraid it doesn’t in my case, or I’m doing something wrong. I have my url ( in both site and blog url. But when I navigate to it gives me a 404.

    Moderator Kathryn


    That sounds like a hosting misconfiguration. Let us know how it goes.

    Well, my host solved the problem with something called a symbolic link. Whatever that may be. 🙂

    Moderator Kathryn


    Perfect. 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘301 redirect and permalinks’ is closed to new replies.