redirecting domain.com to www.domain.com in Apache 2
I heard search engines recognize domain.com and www.domain.com as different addresses. So redirecting domain.com to www.domain.com would be better for开发者_运维技巧 SEO.
How would you do it? I have access to apache.conf
<VirtualHost *:80>
ServerName domain.com
Redirect permanent / http://www.domain.com/
</VirtualHost>
You can put following lines in you .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
If you want this only for SEO purpose then you can also make www.domain.com your prefererred domain in Webmasters Tools.
In Google webmaster you can do
1.Goto https://www.google.com/webmasters/tools/settings?
2. Under "site configurations > settings" you can set your preferred domain.
精彩评论