# Keep Old Feed Addresses Working After Moving to WordPress

> Redirects feed addresses used by Blogger, Ghost, Jekyll, Hugo and other platforms, such as /rss.xml or /feeds/posts/default, to your WordPress feed, so existing subscribers keep receiving posts.

- Type: PHP
- Runs: Run everywhere
- Category: [RSS Feeds](https://wpide.com/library/category/rss/)
- Tags: feeds, migration, redirects
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/feed-addresses-from-other-platforms/

## Code

```php
// Old feed addresses (from Blogger, Ghost, Jekyll, Squarespace ...) that should lead to your WordPress feed.
$wpide_old_feed_paths = array( '/rss.xml', '/feed.xml', '/atom.xml', '/index.xml', '/index.rdf', '/rss', '/feeds/posts/default' );

add_action( 'template_redirect', function () use ( $wpide_old_feed_paths ) {
    if ( ! is_404() ) {
        return;
    }

    $path = isset( $_SERVER['REQUEST_URI'] ) ? (string) wp_parse_url( wp_unslash( $_SERVER['REQUEST_URI'] ), PHP_URL_PATH ) : '';
    $base = (string) wp_parse_url( home_url( '/' ), PHP_URL_PATH );

    if ( '' === $path ) {
        return;
    }

    // Path relative to the site, so subdirectory installs work too.
    $relative = '/' . ltrim( substr( $path, strlen( untrailingslashit( $base ) ) ), '/' );
    $relative = strtolower( untrailingslashit( $relative ) );

    foreach ( $wpide_old_feed_paths as $old ) {
        if ( strtolower( untrailingslashit( $old ) ) === $relative ) {
            wp_safe_redirect( get_feed_link(), 301 );
            exit;
        }
    }
} );
```

## Notes

Only addresses that would otherwise be a 404 are redirected; add any other old feed paths to the list.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Keep Old Feed Addresses Working After Moving to WordPress" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
