301重定向播客Feed

时间:2015-03-23 12:35:37

标签: php wordpress .htaccess redirect rss

我们最近从Clover站点迁移到Wordpress站点,因此我们播客的结构发生了变化。我们有两个播客源,一个用于音频,一个用于视频。

旧的播客提要从这些网址中吸引......

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

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

我们的新饲料正坐在......

http://nmc.church/feed/videopodcast

http://nmc.church/feed/audiopodcast

我尝试过几种不同方式的重定向,但仍然没有运气。我尝试过使用直接301重定向,最近刚转到RewriteRule,但仍然没有工作。不确定它是否重要,但我将旧的nmconline.net域转发到我们新的nmc.church域。

这是我当前的.htaccess文件。

# 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

提前致谢!

1 个答案:

答案 0 :(得分:1)

您无法与QUERY_STRING中的RewriteRule匹配。您可以这样做:

# 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
URL末尾的

?将删除以前的查询字符串。