Please don't call me stupid What's the easiest way to redirect all the pages to www.site.com, so for example site.com/some-stupid-keyword-spammed-page.html would be www.site.com/some-stupid-keyword-spammed-page.html Can you please give me a code to add to .httaccess and where should I add it exactly? thanks
Add the following to .htaccess in your main web directory. Options +SymLinksIfOwnerMatch RewriteEngine On RewriteCond %{HTTP_HOST} ^somedomain.com RewriteRule ^(.*) http://www.somedomain.com/$1 [R=301,L] Code (markup):
thanks, does it matter where I add it exactly? I've added at the end and it doesn't work, nothing changed..
Yes, it has to be in the main web directory. This should be with the index file you have for your home page. Paste your current htaccess so I can see. Your host may not have this enabled.
I'm using hostgator. I've checked it on another domain, there was no .htaccess file, so I've added it and yet no impact..
I don't see hostgator listing htaccess as available. I do believe that you have cPanel. You might have to add htaccess via cPanel. Search around cPanel and see if there is such an option. You may also want to try this similar code. Some server want to have / in there. Options +SymLinksIfOwnerMatch RewriteEngine On RewriteCond %{HTTP_HOST} ^somedomain.com RewriteRule ^/(.*) http://www.somedomain.com/$1 [R=301,L] Code (markup):
ok, thanks, it works now I just forgot to change somedomain.com to my domain it's 3.30 a.m. here and I'm just tired..
I want to know why this would be done? If I put in xxxx.com in my browser window, it goes to the site. If I put in www.xxxx.com in my browser window, it goes to the site (same).
xxx.com and www.xxx.com is viewed by search engines as 2 separate pages. Since the 2 pages would have exactly the same content, duplicate penalty may be imposed by search engines. With the 301, you send non-www to www so that everyone only see one page. A matter of preference really for some people.
So I just put the code shown in previous post in my htaccess file and all is right with the world of search engines? Thank you
that means, we should add these lines of code in all of our sites .htaccess? also, i just checked .htaccess of one of my sites and it was blank-empty...is that ok?
also, why does my site appears without www in msn search results? http://search.msn.com/results.aspx?q=amrita+rao&FORM=QBRE it was always like this from the beginning is this the reason, why i am not ranked well in google, bcoz it sees 2 domains, one with www and one without?
That is precisely what happen when you can pull up a site with and without www. You should add the redirect code to htaccess file so that only www or non-www can be pull up. It is your choice in deciding which version you want to see in SE. If you use the redirect code, one of the version will eventually be deleted by the search engine.