• My server cpu load spikes like crazy when my feeds are accessed, to the point of making the server unresponsive. I use WP (multisite, path-rewrite not subdomain) as a CMS, so I am not terribly interested in the feeds, and I’d just like to turn them off.

    Is it possible to rewrite the WP multisite .htaccess rules to prevent */feed/ from ever being accessed?

    I tried the following functions.php fix, but apparently the hooks kick in too late to prevent the spikes, so I’m thinking .htaccess is a higher-priority kill-switch.

    /**
     * Disable feeds
     */
    
    function fb_disable_feed() {
        wp_die( __('No feed available, please visit our <a href="'. get_bloginfo('url') .'">homepage</a>!') );
    }
    
    add_action('do_feed', 'fb_disable_feed', 1);
    add_action('do_feed_rdf', 'fb_disable_feed', 1);
    add_action('do_feed_rss', 'fb_disable_feed', 1);
    add_action('do_feed_rss2', 'fb_disable_feed', 1);
    add_action('do_feed_atom', 'fb_disable_feed', 1);
Viewing 1 replies (of 1 total)
  • Thread Starter tirussell

    (@tirussell)

    I think this might be what I am looking for – seems to work, but please let me know if this is a bad idea for any reason.

    in .htaccess:

    #Forbid all feeds
    RewriteRule ^feed\/ - [F]
    RewriteRule \/feed\/ - [F]
Viewing 1 replies (of 1 total)
  • The topic ‘Use .htaccess to prevent feed access?’ is closed to new replies.