sitemap 404

Solution to All in One SEO Pack Plug in sitemap.xml 404

I believe that many people use Google XML Sitemaps when they generate sitemap.xml files for websites. My father used to use Google XML Sitemaps before, but later found that the All in One SEO Pack actually contains a sitemap generated component, instead of using Google XML Sitemaps to generate.

I suddenly found the sitemap.xml 404 just now. When I switch to Google XML Sitemaps, it is also 404, I don't know why, but the file cache has been involved in the past two days (After looking at the rules below, it should be that the 404 caused by the 8-day cache of xml is set. It is OK to exclude xml.) Let's talk about Solution for sitemap.xml file 404

404 is basically a pseudo static configuration problem.

For example, when I was writing this article, I suddenly found that I had cached the XML file when I was trying to cache the file. Just remove the cache rules.

Solution to sitemap.xml 404

more The insurance method is to add pseudo static rules to sitemap.xml

The following two pseudo static rule tests are both valid.

The nginx rules recommended by Google XML Sitemaps

 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 Recommended Rules

 #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 pseudo static rule adding method

Just add the above pseudo static rules to the nginx configuration file of your virtual host, and then restart nginx.

Users of LNMP one click package can be directly added to include rewrite/wordpress.conf; The code above.

Pagoda panel users can add the above code to the pseudo static rules of your website.

Other precautions

If you use the cache plug-in, remember to add the following two pages to the exception to avoid visitors accessing the cache page with errors.

sitemap.xml
sitemap.xsl

5/5 - (2 votes)
Scroll to top