WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

function feed_dir_rewrite(){

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

Your Answer


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

Browse other questions tagged or ask your own question.