Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 如何在.htaccess中进行IP规范化?_Linux_.htaccess_Seo - Fatal编程技术网

Linux 如何在.htaccess中进行IP规范化?

Linux 如何在.htaccess中进行IP规范化?,linux,.htaccess,seo,Linux,.htaccess,Seo,今天我在seo工具网站上测试了我的网站,发现以下错误: 您站点的IP xx.xxx.xx.xx不会重定向到您站点的域名。如果搜索引擎在其IP和域名下为您的站点编制索引,则可能会导致重复内容问题。考虑在.htaccess文件中使用301重写规则,以便站点的IP指向您的域名 如何通过.htaccess修复它 谢谢建议您将yourdomain.com重定向到www.yourdomain.com Options +FollowSymLinks RewriteEngine On RewriteBase /

今天我在seo工具网站上测试了我的网站,发现以下错误:

您站点的IP xx.xxx.xx.xx不会重定向到您站点的域名。如果搜索引擎在其IP和域名下为您的站点编制索引,则可能会导致重复内容问题。考虑在.htaccess文件中使用301重写规则,以便站点的IP指向您的域名

如何通过.htaccess修复它


谢谢

建议您将yourdomain.com重定向到www.yourdomain.com

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

资料来源:

对于SO来说,这是离题的;属于webmasters.stackexchange.com这个问题似乎离题了,因为它是关于webmasters的问题是关于IP重定向,而不是www/no www重定向。