Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

From my old static website, I want to preserve some URLs like the RSS Feed one. My feed URL is http://traduction.bainslesbains.com/actualite-russe.xml and I want to redirect it to the category feed URL WITHOUT 301 redirect.

So I tried it via .htaccess file first, what is not working. Then I tried via internal Wordpress URL rewrite system.

So first I did this:

// Rewrite actulaite-russe.xml
function feed_dir_rewrite( $wp_rewrite ) {
    $feed_rules = array(
        'actualite-russe.xml' => 'index.php?cat=8&feed=rss2',
        'actualite-russe.rdf' => 'index.php?cat=8&feed=rdf' . $wp_rewrite->preg_index(1)
    );

    $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
    return $wp_rewrite->rules;
}

// Hook in.
add_filter( 'generate_rewrite_rules', 'feed_dir_rewrite' );

That give me a 301 redirect from

mysite.com/actualite-russe.xml to mysite.com/actualite-russe.xml/feed/
I don't want any 301 redirect I want just been delivered my feed without redirect. So I tried this:

add_action('init','feed_dir_rewrite');
function feed_dir_rewrite(){
        add_rewrite_rule('actualite-russe.xml','index.php?cat=8&feed=rss2','top');
}

That gives me exactly the same result as the previous code.

So how can I disable the 301 redirect for these functions?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.