Support » Plugin: SmartCrawl WordPress SEO checker, SEO analyzer, SEO optimizer » sitemap.xml and robots.txt are giving 404 not found nginx

  • Resolved bananasmoothii

    (@bananasmoothii)


    Hello, I’m on a nginx server, and SmartCrawl is telling me that the sitemap is available but when I go on https://theamplifiedbananabubble.fr/sitemap.xml it gives me a nice “404 not found nginx”. Same for the robots.txt . I tried with an other sitemap plugin that had a message that said if I get 404 not found, I have to put some rewrite rules. Unfortunately, I don’t have access to the nginx config because my website is hosted by a friend, but I can ask him to change some config. Could anyone give me rewrite rules for the sitemap and the robots.txt ? I think the issue has to do with these, but I’m maybe wrong…

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support Pawel – WPMU DEV Support

    (@wpmudev-support9)

    Hello @bananasmoothii

    I hope you’re doing well!

    Please go to your site’s wp-admin, to Settings > Permalnsk, set pretty permalinks, and save changes. Check if the map will load.

    If this will not work, have a look at the suggestion provided here:
    https://www.digitalocean.com/community/questions/404-when-using-pretty-permalinks-on-new-wordpress-site-on-lemp-nginx
    https://nginxlibrary.com/wordpress-permalinks/

    Otherwise, please contact your hosting provider so they could provide you the correct rules.

    Kind regards,
    Nastia

    hay @bananasmoothii how can you fix your blog for your sitemap? i have same trouble like that. i have some website on my server, and some website on cpanel, while i go to my website (my server self) its always be like this. 404 not found.
    my problem , but while my website migrated to cpanel, sitemap is on.
    what can i do for this problem.
    thanks.
    and sorry for my bad english.

    Thread Starter bananasmoothii

    (@bananasmoothii)

    Well, for now, I’m just using another sitemap plugin (google xml-sitemap or something like that), because this plug-in provide some rewrite rules if you get 404 not found, and these work. For the robots.txt, well, It still not working, but I feel like it is not necessary.

    Plugin Support Pawel – WPMU DEV Support

    (@wpmudev-support9)

    Hello @penyintasdelusi

    I trust you’re doing well!

    Please try the adding teh following rules to teh server config and see if this will work for you:

    location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
    rewrite ^/sitemap.xml$ /index.php?wds_sitemap=1&wds_sitemap_type=index last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?wds_sitemap=1&wds_sitemap_type=$1&wds_sitemap_page=$2 last;
    }

    Kind regards,
    Nastia

    Thread Starter bananasmoothii

    (@bananasmoothii)

    `location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
    rewrite ^/sitemap.xml$ /index.php?wds_sitemap=1&wds_sitemap_type=index last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?wds_sitemap=1&wds_sitemap_type=$1&wds_sitemap_page=$2 last;
    }`

    Will this work for the robots.txt too ?

    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    Hi @bananasmoothii

    It’s not quite the same, I’m afraid.

    This code for sitemap.xml implements “pretty link” kind of rewrite but robots.txt file is different and it can either be “virtual” or a real physically existing file.

    The latter shouldn’t be an issue and should be available anyway so I suppose it’s the virtual one. In that case, try adding this code, additionally, to nginx config:

    location = /robots.txt {
        try_files $uri $uri/ /index.php?$args;
        access_log off;
        log_not_found off;
    }

    Best regards,
    Adam

    Plugin Support Pawel – WPMU DEV Support

    (@wpmudev-support9)

    Hello @bananasmoothii

    I hope you are doing well!

    We haven’t heard back from you for a while now so we’ve marked this ticket as resolved. If you do have any followup questions or require further assistance feel free to reopen it and let us know here.

    Kind regards,
    Nastia

    hello @wpmudev-support9
    im sorry for late response.
    i still have issue about my sitemap, before this my web (telkomuniversity.ac.id/sitemap.xml) always go to 404 nginx error, (my server is nginx)
    after that i just add this :
    location ~ ([^/]*)sitemap(.*).x(m|s)l$ {
    rewrite ^/sitemap.xml$ /index.php?wds_sitemap=1&wds_sitemap_type=index last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?wds_sitemap=1&wds_sitemap_type=$1&wds_sitemap_page=$2 last;
    } on server config like you’ve said. But my page just go to my problem
    please, help me to solve this problem.
    (sorry for bad english) thank you.

    Plugin Support Kasia – WPMU DEV Support

    (@wpmudev-support2)

    Hello @penyintasdelusi ,

    Please open separate ticket for your issue per forum regulations.

    kind regards,
    Kasia

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘sitemap.xml and robots.txt are giving 404 not found nginx’ is closed to new replies.