I get a 500 error when trying to access sitemap in production. It works locally.

#1112408
  • Resolved Andreas Yannelos
    Rank Math free

    When trying to access sitemap_index.xml I get a 500 error. Same if I try to access ?sitemap=1. When turning on debug I get this error (pasted in sensitive data). Looking at the error it seems like there is an error in the constant: RankMath\Sitemap\FS_CHMOD_FILE

    I tried to add this to wp-config:
    if (!defined(‘FS_CHMOD_FILE’)) {
    define(‘FS_CHMOD_FILE’, 0644);
    }

    That didn’t solve the issue.

    I’m migrating from Yoast SEO, and deactivated that plugin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello,

    We apologize for the issue you are facing with the 500 error when trying to access your sitemap in production. This can be frustrating, especially since it works locally.

    The 500 error typically indicates a server-side issue. Here are a few steps you can take to troubleshoot and potentially resolve the problem:

    1. Check Server Error Logs: Since you mentioned that you have debug mode on, reviewing the server error logs can provide more insight into what might be causing the 500 error.

    2. Flush the Sitemap Cache: Navigate to Rank Math SEO → Sitemap Settings and change the Links Per Sitemap setting. After saving the changes, go to Settings → Permalinks and click Save Changes again to flush the permalinks. This can sometimes resolve issues with sitemaps.

    3. Check Rewrite Rules: Ensure that your server has the correct rewrite rules in place. If you are using an Apache server, you may need to add specific rewrite rules to your .htaccess file. You can find more information on how to do this in our knowledgebase article.

    4. Permissions: Since you mentioned FS_CHMOD_FILE, ensure that your file permissions are set correctly on your server. The recommended permissions for files are usually 644 and for directories 755.

    5. Caching Plugins: If you have any caching plugins active, ensure that they are not caching the sitemap files. You may need to exclude the sitemap from being cached.

    6. Server Configuration: If you are using NGINX or another server type, ensure that it is configured correctly for Rank Math sitemaps. You may need to consult with your hosting provider for assistance with this.

    If these steps do not resolve the issue, please reply to this ticket with your site URL and any additional details from the error logs, and a human agent from our support team will assist you further. Thank you for your patience!

    I have checked the server logs and pasted them here in sensitive data.

    I have flushed the sitemap cache, saved permalinks and doublechecked that the sitemap isn’t cashed. Even tried to turn of cache completely.

    The rewrite rules are correct, but even ?sitemap=1 throws an error, so I don’t think this is correct.

    Permissions also seems to be correct.

    Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. We are sorry for any inconvenience this issue may have caused you.

    Please access your FTP or your CPanel’s File Manager, locate your website’s root directory, navigate to /wp-content/plugins/, and delete the folder seo-by-rank-math.

    After doing that, please try to reinstall the plugin on your website.

    Please note that all the data from the plugin will remain intact on the database in this process.

    Let us know how it goes.

    Thank you.

    Problem still exists unfortunatly even after removing plugin and reinstalling it.

    Found the solution, I added this to my wp-config.php

    define(‘FS_CHMOD_FILE’, 0644);
    define(‘FS_CHMOD_DIR’, 0755);
    define(‘FS_METHOD’, ‘direct’);

    Hello,

    We are glad to know that this issue has been resolved. Thank you for letting us know.

    This ticket will be closed now, but you can always open a new one if you have any other questions or concerns. We are here to help you with anything related to Rank Math.

    We appreciate your patience and cooperation throughout this process.

    Thank you for choosing Rank Math.

Viewing 6 replies - 1 through 6 (of 6 total)

The ticket ‘I get a 500 error when trying to access sitemap in production. It works locally.’ is closed to new replies.