• Resolved stevethefootycoach

    (@stevethefootycoach)


    Hi

    I’ve moved to Yoast from the Rankmath plugin as Rankmath was slowing my admin panel significantly.

    I like Yoast but I have a problem: my sitemap – broughtonschoolofmotoring.com/sitemap-index.xml – redirects to my homepage.

    The non pretty permalink (/?sitemap=1) does show the sitemap though so I added the following code to my .htaccess:

    # Yoast SEO – XML Sitemap Rewrite Fix
    RewriteEngine On
    RewriteBase /
    RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
    RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
    RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
    RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
    RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?yoast-sitemap-xsl=$1 [L]
    # END Yoast SEO – XML Sitemap Rewrite Fix

    I have cleared the site’s cache and flushed the permalinks.

    But the problem remains.

    I have spoken to my host who say there is no problem at their end and nothing is blocking Yoast on the server.

    Can you assist?

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Sa?a

    (@stodorovic)

    Correct URL is: https://www.broughtonschoolofmotoring.com/sitemap_index.xml and it works.

    Plugin Support Maybellyne

    (@maybellyne)

    Hello @stevethefootycoach,

    Thanks for reaching out.

    The XML sitemap at https://www.broughtonschoolofmotoring.com/sitemap_index.xml and https://www.broughtonschoolofmotoring.com/?sitemap=1 works.

    • This reply was modified 4 years, 6 months ago by Maybellyne.
    Sa?a

    (@stodorovic)

    @maybellyne You didn’t read my previous comment. Yoast uses underscore (_) in sitemap URL (not -). Also, user wrote that already added rewrite rules (which doesn’t needed in this case).

    @stevethefootycoach If you check correct URL then you will see that works.

    PS: I sent URL in previous comment as text to avoid auto-linking.

    Thread Starter stevethefootycoach

    (@stevethefootycoach)

    @stodorovic

    Many thanks for the suggestion but https://www.broughtonschoolofmotoring.com/sitemap_index.xml still redirects to my homepage (not 404).

    Can you send an image of what you see?

    Thread Starter stevethefootycoach

    (@stevethefootycoach)

    @maybellyne

    Thanks but i’ve done all that and still the sitemap does not resolve unless I use the ‘non pretty’ permalink.

    My hosting company say there is no problems with the server settings.

    Sa?a

    (@stodorovic)

    @stevethefootycoach Please use correct URL and clear browser cache. You can see that works:

    $ curl -i https://www.broughtonschoolofmotoring.com/sitemap_index.xml
    HTTP/1.1 200 OK
    Server: Sucuri/Cloudproxy
    Date: Wed, 27 May 2020 10:37:56 GMT
    Content-Type: text/xml; charset=UTF-8
    ...
    Cache-Control: max-age=315360000
    X-Sucuri-Cache: HIT
    
    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.broughtonschoolofmotoring.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
    <sitemapindex xmlns="https://www.sitemaps.org/schemas/sitemap/0.9">
            <sitemap>
                    <loc>https://www.broughtonschoolofmotoring.com/post-sitemap.xml</loc>
                    <lastmod>2020-05-22T20:31:57+00:00</lastmod>
            </sitemap>
    

    sitemapindex.xml is 404
    sitemap_index.xml is correct sitemap index

    Sa?a

    (@stodorovic)

    Now, I see 500 Internal Server Error which could be result of wrong lines in .htaccess file. Please revert previous .htaccess if you have changed it.

    Sa?a

    (@stodorovic)

    It’s possible that rewrite rules in WP aren’t flushed properly. It seems that Sucuri-Cache has cached correct sitemap. Please go to Settings -> Permalink and just click on ‘Save Changes’. It should update rewrite rules inside WP.

    Also, please “undo” all actions which you done in last couple hours if it’s possible. It worked before.

    Plugin Support Maybellyne

    (@maybellyne)

    @stodorovic, I’m sorry I missed your first comment and the underscore part of the URL. You are correct. https://www.broughtonschoolofmotoring.com/sitemap_index.xml works

    @stevethefootycoach The XML sitemap index still loads fine. I have shared a screenshot here. Can you please clear your browser cache or try from a different device?

    Thanks.

    Thread Starter stevethefootycoach

    (@stevethefootycoach)

    @maybellyne @stodorovic
    Yes, it works fine now I have cleared my browser cache. I can see the sitemap. Thanks for your help.

    @stodorovic Your advice has been invaluable. Many thanks for taking the time to assist. The 500 error message you saw has gone but I do get them from time to time. I think I will delete the current .htaccess and start with a fresh copy.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Sitemap redirects to homepage’ is closed to new replies.