• Resolved Rookie

    (@alriksson)


    Sitemap XML 404 since last update.
    sitemap_index.xml is not working nor the child sitemaps.

    Tried to disable sitemap and enable without success. Tried to reinstall Yoast SEO without success.

    Local environment Nginx

    Local 5.4.2 for macOS

    • This topic was modified 4 years, 6 months ago by Rookie.
Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Michael Ti?a

    (@mikes41720)

    @alriksson We apologize for any issues. If your sitemap is showing a 404 status, could you please try to follow the steps in this article and see if this resolves the issue — https://yoast.com/help/my-sitemap-is-giving-a-404-error-what-should-i-do/

    Thread Starter Rookie

    (@alriksson)

    @mikes41720 Thanks assume it needs some rewrites for Nginx, will check with flywheel.

    Hi @alriksson,

    If your site is indeed hosted on NGINX servers, some rewrites need to be done in order to get the pretty permalinks to work. Your webhost should be able to help you with this.

    Hope this helps.

    Thread Starter Rookie

    (@alriksson)

    @jeroenrotty Pretty permalinks are already in place. But seems like yoast need some custom rewrites.

    This is local environment from flywheel, but never been an issue before I think.

    Sa?a

    (@stodorovic)

    If you already added rules for pretty permalinks into NGINX or Apache, then you don’t need extra rules.

    Please check wp rewrite rules (eg. wp-cli rewrite list). Try to just click on ‘Save changes’ on Permalink Settings (WP Dashboard) if there aren’t sitemap rules.

    Could you open sitemaps via query parameters:
    https://domain.com/?sitemap=1
    https://domain.com/?sitemap=page

    Thread Starter Rookie

    (@alriksson)

    @stodorovic Hi has reported to local by flywheel.

    Yes, I can access over query parameters, thanks! But what does that indicate? It is working or not working haha.

    Sa?a

    (@stodorovic)

    It means that there are missing rewrite rules:

    $ wp rewrite list |grep sitemap
    sitemap_index\.xml$     index.php?sitemap=1     other
    ([^/]+?)-sitemap([0-9]+)?\.xml$ index.php?sitemap=$matches[1]&sitemap_n=$matches[2]     other
    ([a-z]+)?-?sitemap\.xsl$        index.php?yoast-sitemap-xsl=$matches[1] other
    

    Yoast SEO adds these rules in inc/sitemaps/class-sitemaps-router.php. It’s possible that some plugin doesn’t follow good practice related to flush_rewrite_rules.

    When you click on ‘Save changes’ (Settings -> Permalinks) WP should call flush_rewrite_rules and correct rewrite rules will be populated into options. Did you try it?

    Thread Starter Rookie

    (@alriksson)

    Did try to save permalinks without success. Seem like local is not following these rules then I assume.

    Plugin Support devnihil

    (@devnihil)

    @alriksson Does the local installation use any type of caching? If so, does clearing the caching correct the 404 status on the sitemap?

    Thread Starter Rookie

    (@alriksson)

    no nginx cache at all as it’s local to see changes. Still stuck think flywheel have to add support.

    Plugin Support amboutwe

    (@amboutwe)

    @alriksson I use Local by Flywheel (v5.4.1+3311) and haven’t had a moment to look into why the rules aren’t working lately. They used to work but had to switch to localhost:port option because the domain.tld option wasn’t working.

    That said, I fixed it (per site so not a great solution) by adding the NGINX rules (here) to the {Path_To_Local_WordPress}/conf/nginx/site.conf file.

    It took a little trial and error but I found that it works when added between the WordPress and static rules, like so (screenshot):

        #
    	# WordPress Rules
    	#
        {{#unless site.multiSite}}
        include includes/wordpress-single.conf;
        {{else}}
        include includes/wordpress-multi.conf;
        {{/unless}}
    
    <insert Yoast rules here>
    
        #
    	# Static file rules
    	#
    

    If this doesn’t work, it does confirm that the Local environment does not have the correct rules which is why the parameter works but the pretty permalink doesn’t. Flywheel should be able to help you figure out where to put the rules in your setup. Hope this helps!

    Plugin Support Md Mazedul Islam Khan

    (@mazedulislamkhan)

    Closed due to inactivity.

    Thread Starter Rookie

    (@alriksson)

    @amboutwe thanks! Will report to Flywheel as well.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Sitemap XML – 404’ is closed to new replies.