• I am attempting to do a 301 redirect for pagerank purposes and am having a little trouble. I am trying to go from http://www.example.com to example.com

    No matter which way I’ve done works. I just get a redirect error in Firefox. Although I can turn example.com into http://www.example.com without any issues, but I’m lazy and don’t want the www

    This code works for me for having http://www.example.com

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^www.joeschmo.com$ [NC]
    RewriteRule ^(.*)$ http://www.joeschmo.com/$1 [L,R=301]

    However this code does not work for example.com

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^joeschmo.com$ [NC]
    RewriteRule ^(.*)$ http://joeschmo.com/$1 [L,R=301]

    I should probably start another post but if some can figure this out, im sure they know the answer to this also.

    How do I incorporate a blavatar (icon next to url) on my domain?
    This does not help: http://wpxpert.wordpress.com/2010/02/18/blog-avatar/

    I do not have a settings option in the top right corner of my WP Admin panel, not sure if it has to do with my host bluehost.com

    I do have a settings option in the left column but there is no option to upload an image for cropping and displaying as my avatar.

    Thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    Check with this code:

    # Redirect www to non-www
    RewriteCond %{HTTP_HOST} ^www\.(.*)
    RewriteRule (.*) http://%1/$1 [R=301,L]

    Thanks,

    Shane G.

    Thread Starter mldriggs

    (@mldriggs)

    Right now it is set for non www to www and it appears as though my post links get 404 errors.

    Not sure if messing with the .htaccess is causing this. I even wrote a new post and when I try and click on the link I get a 404.

    This what I have written now as suggested, doesn’t seem to work:

    RewriteCond %{HTTP_HOST} ^www.joeschmo.com\.(.*)
    RewriteRule (.*) http://joeschmo.com%1/$1 [R=301,L]

    Whether or not the site uses www depends mostly on the wordpress URL and the blog URL. In your dashboard go to Settings > General and then setup the URL in the blog URL and wordpress URL to not use www.

    Thread Starter mldriggs

    (@mldriggs)

    @bh_wp_fan

    That worked like a charm. Thanks so much. Will this also resolve any problem with google indexing my site and spliting up my pages ranks between the www and non www version?

    Should I still have the 301 permanent redirect, or do it not matter anymore? Or will it work now that I have the settings fixed in the dashboard.

    The issue with 404 errors was with my permalink settings. I changed them back to ugly mode then back to pretty mode and it seemed to fix the problem. Who knows how often this will happen. I have been attempting to load up my permalink with some keywords in the post, while titling it something that would attract a human being.

    It should solve the problem with google… eventually.
    No, you don’t need a separate 301 redirect.
    Yes, changing, then changing back permalinks, or oftentimes, just re-clicking the “Save Permalinks” button, will fix permalinks-based 404 errors.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘help with 301 redirect in .htaccess from www to non-www’ is closed to new replies.