hello
my site with www and without www are two different pages. please suggest me how to resolve this problem?

Comments

khanz’s picture

Open your .htaccess file and edit this portion accordingly...

# If your site can be accessed both with and without the 'www.' prefix, you
  # can use one of the following settings to redirect users to your preferred
  # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
  #
  # To redirect all users to access the site WITH the 'www.' prefix,
  # (http://example.com/... will be redirected to http://www.example.com/...)
  # adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
  # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
  #
  # To redirect all users to access the site WITHOUT the 'www.' prefix,
  # (http://www.example.com/... will be redirected to http://example.com/...)
  # uncomment and adapt the following:
  # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
  # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

------------
Volvo, Video, Velcro. (I came, I saw, I stuck around.)

itsmemohit’s picture

I edited the htaccess file but it is still not redirecting.

I removed the # from these lines:

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

khanz’s picture

Is your site live or hosted locally? Uncomment only one redirect rule and replace 'example.com' with your real website url. Following rule is to redirect non 'www' address to site with 'www' prefix.

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

------------
Volvo, Video, Velcro. (I came, I saw, I stuck around.)

itsmemohit’s picture

LOL.. Even I forgot to replace the URL. Thanks

ashoksharma’s picture

i done that but still when i login with a user on the site with www, after removing www, its log out.
i just removed two comments from this code

MakeOnlineShop’s picture

If your host was dreamhost you would have options on your domain name to redirect http://yoursite to http://www.yoursite as Google does for its own sites.

ashoksharma’s picture

i done it
i was not replacing the name of site
i removed the comments and replaced www.example.com to www.seoabc.in and its done
thanks buddies

chiclets85’s picture

Thanks guys for the info, i had the same problem and you guys are super helpful (itsmemohit)

i want to make money