sitemap.xml redirect to main page
-
I use this plugin Yoast SEO on all my sites and have never encountered such a problem.
There is a site with a large amount (~300,000) of content, and it was transferred to WordPress. When accessing the sitemap file, it turned out that it does not load. White screen and errors parsing the XML document. At first, I thought that the problem was related to the server load, but the admins said that the load was normal.Then I began to try to get a physical sitemap file, adding a filter to the code, by which I saved the value to the file. The file turned out to be correct and valid. The problem is that the browser could not access the xsl style file for display.
I began to figure it out and simply copied your filewordpress-seo/css/main-sitemap.xsl
to the root of the site.
or, exclude it grom sitemap, using filter'wpseo_stylesheet_url'
And then it started:
- a request to the
/sitemap.xml
redirects to the main page of the site - a request with a parameter
/?sitemap=1
– shows the sitemap - a request to the
/sitemap_index.xml
– redirects to the main - a request to the
/sitemap_index.xml/
with a final slash – shows the sitemap - following links from the sitemap index, like
post_sitemap20.xml
– redirects to the main page
- here are my redirection rules (at the top of the array)
Array ( [sitemap_index\.xml$] => index.php?sitemap=1
[([^/]+?)-sitemap([0-9]+)?\.xml$] => index.php?sitemap=$matches[1]&sitemap_n=$matches[2]
[([a-z]+)?-?sitemap\.xsl$] => index.php?yoast-sitemap-xsl=$matches[1]
...
[^wp-sitemap\.xml$] => index.php?sitemap=index
[^wp-sitemap\.xsl$] => index.php?sitemap-stylesheet=sitemap
[^wp-sitemap-index\.xsl$] => index.php?sitemap-stylesheet=index
[^wp-sitemap-([a-z]+?)-([a-z\d_-]+?)-(\d+?)\.xml$] => index.php?sitemap=$matches[1]&sitemap-subtype=$matches[2]&paged=$matches[3]
[^wp-sitemap-([a-z]+?)-(\d+?)\.xml$] => index.php?sitemap=$matches[1]&paged=$matches[2]
Interestingly, all requests to
wp_sitemap
result in 404 error- neither Apache nor Nginx have redirection rules for the sitemap mask – only a refusal to cache
- in the W3 Total Cache caching plugin, the sitemap file mask is included in the list of excluded caching
- I use a custom URL for the blog, but I use a filter
'wpseo_stylesheet_url'
for the base URL issuing /
I used the Health Check & Troubleshooting plugin – reset until all plugins were completely disabled – the problem persisted.
Maybe you know of any solutions to this problem?The page I need help with: [log in to see the link]
- a request to the
- You must be logged in to reply to this topic.