Seth Douwsma
Seth Douwsma

Reputation: 67

301 Redirect for Podcast Feed

We recently moved from a Clover site to a Wordpress site so the structure on our podcasts has changed. We have two podcast feeds, one for audio, and one for video.

The old podcast feeds were pulling in from these urls...

http://nmconline.net/podcast.php?pageID=27

http://nmconline.net/podcast.php?pageID=28

Our new feeds are sitting at...

http://nmc.church/feed/videopodcast

http://nmc.church/feed/audiopodcast

I've tried the redirect a few different ways but still no luck. I've tried using a straight 301 redirect and just recently move to a RewriteRule, but still won't work. Not sure if its important or not, but I am forwarding the old nmconline.net domain to our new nmc.church domain.

Here is my current .htaccess file.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^podcast\.php?pageID=27 http://nmc.church/feed/videopodcast [R=301,L]
RewriteRule ^podcast\.php?pageID=28 http://nmc.church/feed/audiopodcast [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Thanks in advance!

Upvotes: 1

Views: 343

Answers (1)

anubhava
anubhava

Reputation: 785186

You cannot match QUERY_STRING in a RewriteRule. Here is how you can do:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} ^pageID=27$ [NC]
RewriteRule ^podcast\.php$ http://nmc.church/feed/videopodcast? [R=301,L]

RewriteCond %{QUERY_STRING} ^pageID=28$ [NC]
RewriteRule ^podcast\.php$ http://nmc.church/feed/audiopodcast? [R=301,L]

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

? at the end of URL will remove previous query string.

Upvotes: 1

Related Questions