Sitemap keeps giving 404

#370283
  • Resolved Robert van Grinsven
    Rank Math free

    Hi,
    I tried flushing the perm links and adding sitemap.xml to the exclude list of my litespeed cache plugin, but still am getting the 404 error page when I click on the sitemap index link. Is there another cache I need to flush maybe and how can I find / debug this?

    Kind regards
    Robert van Grinsven

Viewing 5 replies - 1 through 5 (of 5 total)
  • Nigel
    Rank Math business

    Hello,

    Thank you for contacting Rank Math for help fixing your sitemap 404 error and sorry for the inconvenience this has caused you.

    Please refer to our guide on how to fix a sitemap 404 error: https://rankmath.com/kb/sitemap-404-error/

    Hope that helps. If you have questions, ask away.

    Good morning,
    Thank you for your reply. Before asking for help, I already tried the now offered solution:

    I tried flushing the perm links and adding sitemap.xml to the exclude list of my litespeed cache plugin,

    As with these options it still does not work, I turned to you in order to see how I could find the reason why it is not working.

    Thank you in advance.

    Kind reagrds,
    Robert van Grinsven

    Anas
    Rank Math business

    Hello,

    Please add this filter in the theme’s functions.php file:

    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');
    

    Here is a guide you can follow to add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/#functions-php-file

    Once done, clear your website cache and check the sitemap.

    Let us know if the issue persists.

    We are here to assist you.

    Hi,
    Thank you for this tip! I tried to add the line in my functions.php file, but am not sure it is added at the right place. I added it here:


    <?php

    $thegem_use_new_theme_options = true;
    $thegem_use_new_page_options = true;
    $thegem_use_old_theme_options = true;
    $thegem_use_old_page_options = false;

    require get_template_directory() . ‘/inc/template-tags.php’;
    require get_template_directory() . ‘/inc/options.php’;
    if ($thegem_use_new_theme_options || $thegem_use_new_page_options) {
    require get_template_directory() . ‘/inc/theme-options/theme-options.php’;
    }
    require get_template_directory() . ‘/inc/content.php’;
    require get_template_directory() . ‘/inc/post-types/init.php’;
    require get_template_directory() . ‘/inc/woocommerce.php’;
    require get_template_directory() . ‘/inc/megamenu/megamenu.class.php’;
    require get_template_directory() . ‘/inc/megamenu/megamenu-walker.class.php’;
    require get_template_directory() . ‘/inc/image-generator/image-editor.class.php’;
    require get_template_directory() . ‘/inc/image-generator/image-generator.php’;

    require get_template_directory() . ‘/inc/pagespeed/pagespeed.class.php’;

    require get_template_directory() . ‘/plugins/plugins.php’;

    require_once ABSPATH . “wp-admin” . ‘/includes/file.php’;

    if ( ! defined( ‘THEGEM_PAGE_EDITOR’ ) ) {
    define( ‘THEGEM_PAGE_EDITOR’, ‘wpbackery’ );
    }

    if ( ! isset( $content_width ) ) {
    $content_width = 1170;
    }

    if(!function_exists(‘thegem_setup’)) :
    function thegem_setup() {
    load_theme_textdomain(‘thegem’, get_template_directory() . ‘/languages’);
    add_theme_support(‘automatic-feed-links’);
    add_theme_support(‘post-thumbnails’);
    add_theme_support(‘woocommerce’);
    add_theme_support(‘title-tag’);
    remove_theme_support( ‘widgets-block-editor’ );
    set_post_thumbnail_size(672, 372, true);
    add_image_size(‘thegem-post-thumb’, 256, 256, true);
    add_image_size(‘thegem-custom-product-categories’, 766, 731, true);
    register_nav_menus(array(
    ‘primary’ => esc_html__(‘Top primary menu’, ‘thegem’),
    ‘footer’ => esc_html__(‘Footer menu’, ‘thegem’),
    ‘top_area’ => esc_html__(‘Top area menu’, ‘thegem’),
    ));
    add_theme_support(‘html5’, array(
    ‘search-form’, ‘comment-form’, ‘comment-list’, ‘gallery’, ‘caption’
    ));
    add_theme_support(‘post-formats’, array(
    ‘image’, ‘video’, ‘audio’, ‘quote’, ‘gallery’,
    ));
    add_theme_support(‘featured-content’, array(
    ‘featured_content_filter’ => ‘thegem_get_featured_posts’,
    ‘max_posts’ => 6,
    ));
    add_filter(‘use_default_gallery_style’, ‘__return_false’);

    function thegem_jpeg_quality() { return 80; }
    add_filter( ‘jpeg_quality’, ‘thegem_jpeg_quality’, 10, 2 );

    if(!get_option(‘thegem_theme_options’)) {
    update_option(‘thegem_theme_options’, thegem_first_install_settings());
    delete_option(‘thegem_activation’);
    }
    add_filter( ‘rank_math/sitemap/enable_caching’, ‘__return_false’);
    $thegem_theme = wp_get_theme(wp_get_theme()->get(‘Template’));
    $option_version = thegem_get_option(‘theme_version’);
    :
    :

    I flushed the Cash I could flush and re-did the original actions like changing the 200 number to 199, saving and re-initiate the perm links.

    Still the 404 persists.

    Was the location of the line wrong, or did I overlook something?

    Kind regards,
    Robert van Grinsven

    Anas
    Rank Math business

    Hello,

    The filter should be added at the bottom of the functions.php file.

    If the issue persists, we would like to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘Sitemap keeps giving 404’ is closed to new replies.