优化WordPress网站robots协议,并通过Rank Math添加管理
优采云 发布时间: 2022-06-04 13:29优化WordPress网站robots协议,并通过Rank Math添加管理
Robots协议就是搜索引擎爬取网站要遵守的协议和标准,也叫做爬虫协议、机器人协议等。有了robots协议,就可以让搜索引擎派出的爬虫机器人知道,我们的网站中哪些网页内容可以抓取,哪些网页内容是不能抓取。设置好robots协议不仅有利于网站SEO,也可以通过协议有效避免不必要的抓取从而减轻服务器的负担。我们通常通过在网站根目录添加robots.txt文件来存放爬虫协议。本文主要分享下如何通过Rank Math这个SEO优化插件来优化并添加robots协议。
1.WordPress默认robots协议
wordpress默认的规则协议比较简陋,规则有些少,很多内容我们是不建议搜索引擎搜索的,比如后台wp-admin等
User-agent: *<br />Disallow: /wp-admin/<br />Disallow: /wp-includes/<br />Allow: /wp-admin/admin-ajax.php
2.优化后的robots协议
以下是网上各位大神总结优化后的robots协议,可以直接添加使用。其中红色部分要修改为你网站的sitemap地址。
User-agent: *<br />Allow: /wp-content/uploads/<br />Allow: /*.html$<br />Allow: /*.png$<br />Allow: /*.jpg$<br />Allow: /*.jepg$<br />Allow: /*.gif$<br />Allow: /*.bmp$<br />Disallow: /wp-admin/<br />Disallow: /wp-login.php<br />Disallow: /wp-includes/<br />Disallow: /wp-content/plugins<br />Disallow: /wp-content/themes<br />Disallow: /wp-config-sample.php<br />Disallow: /refer/<br />Disallow: /search/<br />Disallow: /trackback/<br />Disallow: /comments/<br />Disallow: /attachment/<br />Disallow: /comments/feed<br />Disallow: /feed<br />Disallow: /*/feed<br />Disallow: /*/comment-page-*<br />Disallow: /*?replytocom=*<br />Disallow: /*/trackback<br />Disallow: /?s=*<br />Disallow: /*/?s=*\<br />Disallow: /wp-*.php<br />Disallow: /go.php?url=*<br /><br />Sitemap:https://yourdomain.com/sitemap_index.xml<br />Sitemap:https://yourdomain.com/post-sitemap.xml<br />Sitemap:https://yourdomain.com/page-sitemap.xml<br />Sitemap:https://yourdomain.com/product-sitemap.xml<br />Sitemap:https://yourdomain.com/category-sitemap.xml
3.Rank Math添加设置robots协议
登录WordPress网站后台》点击Rank Math》General Settings》Edit robots.txt
在设置窗口直接复制粘贴上面优化的robots协议,sitemap地址记得改成你自己的网站地图
最后点击【Save changes】即可
4.查看网站robots协议
在浏览器窗口输入即可以看到网站的robots协议
最后总结
网站robots协议对于我们网站SEO优化还是非常重要的,值得重视,特别是很多新手站长往往忽视这个文件。如果你没有安装Rank Math这款SEO插件,也可以自己创建一个robots.txt的文件,粘贴好上面的robots协议规则,然后上传到网站根目录即可。当然其他类似的SEO插件,比如Yoast SEO插件基本也提供robots管理功能。方法是一样的。