• Hello there!

    I am writing here because i have problem with custom feeds that I have created for my wordpress.

    What happen is that it does not seems to be valid and my answer from http://feedvalidator.org/ is that the Server returned HTTP Error 404: Not Found

    Here is how I call my custom rss feeds:

    remove_all_actions( 'do_feed_rdf', 'do_feed_rdf', 10, 1 );
    remove_all_actions( 'do_feed_rss', 'do_feed_rss', 10, 1 );
    remove_all_actions( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
    remove_all_actions( 'do_feed_atom', 'do_feed_atom', 10, 1 );
    
    add_action( 'do_feed_rss2', 'rss2', 10, 1 );
    function rss2( $for_comments ) {
    	load_template( TEMPLATEPATH . '/feeds/feed.php' );
    }
    
    global $allfeeds;
    $allfeeds = array(
      	"news",
      	"tour-dates",
      	"bands",
      	"videos",
      	"tracks",
      	"pictures",
      	"festivals"
    );
    
    foreach ($allfeeds as $f){
    	$f2 = preg_replace("/-/", "_", $f);
    	eval("
    							function create_".$f2."_feed () {
    								load_template( TEMPLATEPATH . '/feeds/feed-".$f.".php');
    							}
    					");
    }
    
    // Replace default feed rewrite rules
    function customise_feed_rules($rules) {
        global $allfeeds;
        foreach ($allfeeds as $f){
        	$new_rules["feed\/".$f] = "index.php?feed=".$f."_feed";
        }
        return $new_rules + $rules;
    }
    
    // Add the custom feed and update rewrite rules
    function add_custom_feed() {
    		global $allfeeds;
    
    		foreach ($allfeeds as $f){
    			$f = preg_replace("/-/", "_", $f);
      	add_action("do_feed_".$f."_feed", "create_".$f."_feed", 10, 1);
      }
    
      add_filter('rewrite_rules_array','customise_feed_rules');
    }
    
    add_action('init', 'add_custom_feed');

    And here is a sample of a RSS file:

    <?php header("Content-Type: application/xml; charset=UTF-8"); echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> 
    
    <rss version="2.0"
    	xmlns:content="http://purl.org/rss/1.0/modules/content/"
    	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    	xmlns:dc="http://purl.org/dc/elements/1.1/"
    	xmlns:atom="http://www.w3.org/2005/Atom"
    	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    >
    
    <channel>
        <title>TITLE</title>
    
        <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
        <link><?php self_link(); ?></link>
        <description>WORDPRESS_DESCRIPTION</description>
        <language><?php bloginfo_rss( 'language' ); ?></language>
    
        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', current_time('mysql', 1), false); ?></pubDate>
    		<lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('gmt'), false); ?></lastBuildDate>
    		<sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
    		<sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
    
        <copyright>Copyright <?php echo mysql2date('Y', current_time('mysql', 1), false); ?>, Match&Fuse</copyright>
        <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    
    		<?php $articles = get_the_posts_list( array(
    				"postype"	=>	'band',
    				"limit"		=>	20,
    				"sortby"	=>	'post_date_gmt'
    			));
    			http://www.matchandfuse.co.uk/feed/bands
    		?>
    
        <?php foreach ($articles as $a): ?>
        <item>
    			<title><?php echo htmlspecialchars($a["title"]) ?></title>
    			<link><?php echo $a["permalink"] ?></link>
    			<pubDate><?php echo date('D, d M Y H:i:s +0000', $a["post_date"]); ?></pubDate>
    			<?php if (strlen($a["excerpt"]) >=5 ): ?>
    				<description><![CDATA[<?php echo htmlspecialchars($a["excerpt"]) ?>]]></description>
    			<?php else: ?>
    				<description><![CDATA[<?php echo htmlspecialchars(my_excerpt($a["content"], 100 , "words", true  )) ?>]]></description>
    			<?php endif; ?>
    			<content:encoded><![CDATA[<?php echo htmlspecialchars(apply_filters( 'the_content', $a["content"] )) ?>]]></content:encoded>
    		</item>
    
    		<?php endforeach; ?>
    
    	</channel>
    </rss>

    PS: I am using a home made query system apart from wordpress, but it is not supposed to have any influence over the thing!

    I think the problem is related to the way i Call them…

    The rss php files are there:
    http://www.matchandfuse.co.uk/wp/wp-content/themes/matchfuse-v1.2/feeds

    Thank you a lot…
    Catherine

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘RSS return Server returned HTTP Error 404: Not Found on Server returned HTTP Err’ is closed to new replies.