All in One SEO Pack插件sitemap.xml 404的解決辦法
本文圍繞“All in One SEO Pack插件sitemap.xml 404的解決辦法”整理操作說明與配置思路。界面名稱可能隨軟件版本調整,修改線上網站前請保存備份。涉及使用體驗的描述屬於來源作者,本頁未提供獨立實測結論。 相信很多人在給網站生成sitemap.xml文件的時候都是使用的Goo

基本資訊
- 資料範圍
- 完整文章正文,已清理外鏈和來源推廣
- 正文插圖
- 0個真實URL;0張已本地化,其餘使用原圖待補
本文圍繞“All in One SEO Pack插件sitemap.xml 404的解決辦法”整理操作說明與配置思路。界面名稱可能隨軟件版本調整,修改線上網站前請保存備份。涉及使用體驗的描述屬於來源作者,本頁未提供獨立實測結論。
相信很多人在給網站生成sitemap.xml文件的時候都是使用的Google XML Sitemaps這款插件,來源作者之前也是,後來發現All in One SEO Pack的功能裏面實際上自帶了一個sitemap生成的組件,就沒有使用Google XML Sitemaps來生成了。
剛纔突然發現sitemap.xml 404了,切換到Google XML Sitemaps同樣是404,不知道是什麼原因,這兩天就折騰了文件緩存(看了下規則,應該就是xml設置了緩存8天導致的404,把xml排除出去就可以了。)下面說下sitemap.xml文件404的解決辦法。
出現404的情況基本上都是僞靜態配置的問題。
例如寫這篇文章的時候突然發現原來是我折騰文件緩存的時候把xml文件也緩存了,去掉緩存規則就可以了。
sitemap.xml 404的解決辦法
更保險的方法是給sitemap.xml添加僞靜態規則。
以下兩個僞靜態規則測試都有效。
Google XML Sitemaps這款插件推薦的nginx規則
rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;
All in One SEO Pack推薦的規則
#rewrite rules for AIOSEOP XML Sitemap rewrite ^/sitemap.xml$ /index.php?aiosp_sitemap_path=root last; rewrite ^/sitemap_(.+)_(\d+).xml$ /index.php?aiosp_sitemap_path=$1&aiosp_sitemap_page=$2 last; rewrite ^/sitemap_(.+).xml$ /index.php?aiosp_sitemap_path=$1 last; rewrite ^/sitemap.xml.gz$ /index.php?aiosp_sitemap_path=root.gz last; rewrite ^/sitemap_(.+)_(\d+).xml.gz$ /index.php?aiosp_sitemap_path=$1.gz&aiosp_sitemap_page=$2 last; rewrite ^/sitemap_(.+).xml.gz$ /index.php?aiosp_sitemap_path=$1.gz last;
Nginx僞靜態規則添加方法
只需要將上面的僞靜態規則添加到你虛擬主機的nginx配置文件,然後重啓nginx即可。
LNMP一鍵包的用戶,直接添加到include rewrite/wordpress.conf;這串代碼上面。
寶塔面板用戶,在你網站的僞靜態規則裏面添加上面的代碼即可。
其他注意事項
如果你使用了緩存插件,那麼記得把下面這兩個頁面都添加到例外,以免出現遊客訪問緩存頁面出錯的情況。
sitemap.xml
sitemap.xsl
本站整理公開產品資料與建站知識,介紹不代表實際使用測試。功能、價格、授權和支援範圍請在購買前向提供方確認。 閱讀推廣披露






SHARE YOUR QUESTIONS
交流與討論
分享你的問題和經驗。請勿釋出廣告、敏感資訊或未經核實的評價。