0

我刚刚将一个博客从 Squarespace 移到了自托管的 WordPress,并且正在尝试设置一个重写规则,以便旧的 RSS 链接将继续为现有订阅者工作。

我正在使用的 URL 如下:

Squarespace:http ://example.com/blog/atom.xml WordPress:http ://example.com/feed/

我在我的functions.php中添加了以下代码

add_action( 'init', 'ss_feed' );
function ss_feed()
{
    global $wp_rewrite;
    $wp_rewrite->add_external_rule( 'blog/atom\.xml$', 'feed/' );
} 

这已成功导致我的 .htaccess 文件被更新:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^blog/atom\.xml$ /feed/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

但是点击http://example.com/blog/atom.xml仍然会导致 WordPress 404。任何人都可以阐明这里可能存在的问题吗?请注意,我启用了 WP Super Cache,并且它在 .htaccess 中也有一个大块,如果人们认为这可能相关,我可以在此处添加。

4

1 回答 1

0

作为故障排除的第一步,在 Wordpress 管理员中刷新您的永久链接。这通常可以解决此类问题。

于 2013-04-25T04:41:16.093 回答