Puddinq.com sharing knowledge

Remove /feed/ from url

Remove /feed/ from url

Somehow your site git indexed with the feed url’s and even worse when the url does not excists in google anymore, google gives you two errors. One for the url and one for the same link with /feed/ behind it. To solve this you can use two actions.

  1. One: remove the feed from wh-head
    /**
     * Disable feed
     * Add this to functions.php in your theme
     */
    
    remove_action('wp_head', 'feed_links_extra', 3);
    remove_action('wp_head', 'feed_links', 2);
    
    

    This removes the

    <link rel="alternate" type="application/rss+xml" title="YOUR_TITLE &raquo; Feed" href="http://www.YOUR_DOMAIN.com/feed/">
  2. Two: add an htaccess rule to redirect the url
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(.+)/feed/$ http://www.YOUR-DOMAIN.com/$1/ [R=301,L]
    <IfModule>
    

    This redirects every request for a feed to the corresponding page