【发布时间】:2013-09-25 10:32:48
【问题描述】:
我已经在 /en 文件夹中安装了 wordpress,并在 / 上设置了 siteurl。我将其转换为多站点网站。它在 topcanadavisa.com 上运行。
我在 function.php 上使用了这段代码来定义新的 post_type(文章):
function codex_custom_init() {
register_taxonomy('articles-category',array(), array(
'has-archives' => true,
'hierarchical' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'archive' ),
));
register_post_type('articles', array(
'capability_type' => 'post',
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'query_var' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'supports' => array( 'title', 'editor', 'excerpt', 'trackbacks', 'thumbnail' , 'author', 'custom-fields' ),
'rewrite' => array( 'slug' => 'articles' ),
'has-archives' => true,
'taxonomies' => array( 'articles-category' ,'post_tag')
));
//flush_rewrite_rules();
} add_action( 'init', 'codex_custom_init' );
wordpress 将这些设置在 .htaccess 上:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) en/$2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ en/$2 [L]
RewriteRule . index.php [L]
发生的事情是我无法设置自定义永久链接。除“page”类型外的所有帖子类型均返回 404 错误。我该怎么办?
【问题讨论】:
标签: wordpress .htaccess http-status-code-404 permalinks