• Resolved DotsConnected

    (@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?

    Thanks,
    Sabra

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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} ^yourdomain.com
    RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]

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

    Thread Starter DotsConnected

    (@dotsconnected)

    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. 🙂

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter DotsConnected

    (@dotsconnected)

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

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

    Thread Starter DotsConnected

    (@dotsconnected)

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

    Perfect. 🙂

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