301 redirect from www to non-www not working

Discussion in 'Site & Server Administration' started by poseidon, Jun 1, 2006.

  1. #1
    Hi,

    After reading a DP thread where it was mentioned that www and non-www is not good for seo and you should redierct one to other, I used this code in my .htaccess at my site Man Silver Jewelry to redirect it from www.mysite.com to mysite.com
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
    Code (markup):
    But there is no redirection from www to non-www ,you can yourself see that. Do I need to add anymore lines ?

    Edit - after verifying at the site http://no-www.org/index.php - it's saying no redirection detected

    Testing www.man-silver-jewellery.info for redirect to man-silver-jewellery.info
    www.man-silver-jewellery.info does not redirect to man-silver-jewellery.info
    Code (markup):

     
    poseidon, Jun 1, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RewriteEngine on
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php3\ HTTP/ 
    RewriteRule ^index\.php3$ http://www.domain.co.uk [R=301,L] 
    RewriteCond %{HTTP_HOST} ^domain.co.uk
    RewriteRule (.*) http://www.domain.co.uk/$1 [R=301,L]
    Code (markup):
    This redirects to the www version. IMO the best thing to do.
     
    mad4, Jun 1, 2006 IP
    cabdirazzaq likes this.
  3. poseidon

    poseidon Banned

    Messages:
    4,356
    Likes Received:
    246
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oh thanks...though I have solved the problem :) (don't know how but things started to worked) must be a cache problem I guess. By the way Mad4, which one is better from www to no-www or the otherway around ?

    I also found a nice tutorial on 301 redirection http://ekstreme.com/webmaster/301-redirection.php ;)
     
    poseidon, Jun 1, 2006 IP