WordPress 301 Redirect Issue (For SEO Purposes) (2 posts)

  1. Vpr99
    Posted 4 years ago #

    Hello all,

    I'm trying to use a .htaccess redirect to add 'www' to the URLs of some sites that I built. I'm trying to do this so that Google Analytics doesn't duplicate the results, whether people go to http://www.example.com, or just example.com.

    I've tried using various codes to perform the redirect, and it either creates a redirect loop or doesn't work. I am also open to using plugins or javascript, but I'm not familiar with Apache and would prefer to stay away from that if all possible.

    Any help in this matter would be greatly appreciated!

  2. sysopsavant
    Posted 4 years ago #

    I'm trying to do the same thing. This is what I currently have:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} !^www.morrispaint.com [NC]
    RewriteRule ^(.*)$ http://www.morrispaint.com/$1 [L,R=301]

    The only problem I notice is that when I type morrispaint.com it redirects fine but i get this string in the address bar:

    But then any links I click to pages or posts result in the normal URLs showing and clicking the home link shows just http://morrispaint.com so I'm not sure why the initial redirect shows the way it does. Regardless it does work though. The issue may stem from recently problems with the W3 Total Cache plugin and manual adjustments that I've had to make to account for those issues.

    If anyone knows why the address is showing as above please point it out so I can fix it.

Topic Closed

This topic has been closed to new replies.

About this Topic