将%postname%标记与自定义Permastruct一起使用会从服务器创建400个错误请求错误

时间:2011-06-24 作者:Manny Fleurmond

这与我先前提出的另一个问题有关。我正在编写一些重写代码,为自定义帖子类型创建一些自定义永久链接。我想我已经基本上成功了,除了以下错误:

400 Bad Request我注意到了几件事:

在url字段中,无论我的帖子名是什么,都会被替换为%postname%

  • 如果我省略了帖子名,它会加载到WordPress中没有问题,这里是设置重写的代码:

    add_action(\'init\', \'setup_rewrites\');
    function setup_rewrites() {
            global $wp_rewrite;
            //Content
            add_rewrite_tag(\'%seriesname%\',\'([^/]+)\');
            add_rewrite_tag(\'%contenttype%\',\'([^/]+)\');
            $content_struct = \'/content/%seriesname%/%contenttype%/%postname%\';
            add_permastruct(\'veda_content\', $content_struct, false);
    
        }
    
    示例url不起作用,但应:http://watchonepiecelegally.com/content/one-piece/episode/test-1

    有效的URL:http://watchonepiecelegally.com/content/one-piece/episode/

    我通过Jan Fabry的重写分析器插件获得的信息:enter image description here

    这应该有用,但我遗漏了一些东西。谁能帮我一把吗?

    编辑:根据要求,以下是Wordpress正在生成的重写规则。希望这有助于:

    Array
    (
        [category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
        [category/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?category_name=$matches[1]&feed=$matches[2]
        [category/(.+?)/page/?([0-9]{1,})/?$] => index.php?category_name=$matches[1]&paged=$matches[2]
        [category/(.+?)/?$] => index.php?category_name=$matches[1]
        [tag/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
        [tag/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?tag=$matches[1]&feed=$matches[2]
        [tag/([^/]+)/page/?([0-9]{1,})/?$] => index.php?tag=$matches[1]&paged=$matches[2]
        [tag/([^/]+)/?$] => index.php?tag=$matches[1]
        [type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]
        [type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?post_format=$matches[1]&feed=$matches[2]
        [type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?post_format=$matches[1]&paged=$matches[2]
        [type/([^/]+)/?$] => index.php?post_format=$matches[1]
        [anime-series/.+?/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime-series/.+?/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime-series/.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-series/.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-series/.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime-series/(.+?)/trackback/?$] => index.php?veda_series=$matches[1]&tb=1
        [anime-series/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_series=$matches[1]&feed=$matches[2]
        [anime-series/(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_series=$matches[1]&feed=$matches[2]
        [anime-series/(.+?)/page/?([0-9]{1,})/?$] => index.php?veda_series=$matches[1]&paged=$matches[2]
        [anime-series/(.+?)/comment-page-([0-9]{1,})/?$] => index.php?veda_series=$matches[1]&cpage=$matches[2]
        [anime-series/(.+?)(/[0-9]+)?/?$] => index.php?veda_series=$matches[1]&page=$matches[2]
        [anime-release/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime-release/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime-release/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-release/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-release/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime-release/([^/]+)/trackback/?$] => index.php?veda_release=$matches[1]&tb=1
        [anime-release/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release=$matches[1]&feed=$matches[2]
        [anime-release/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release=$matches[1]&feed=$matches[2]
        [anime-release/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_release=$matches[1]&paged=$matches[2]
        [anime-release/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_release=$matches[1]&cpage=$matches[2]
        [anime-release/([^/]+)(/[0-9]+)?/?$] => index.php?veda_release=$matches[1]&page=$matches[2]
        [anime-release/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime-release/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime-release/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-release/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-release/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime_video/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime_video/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime_video/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_video/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_video/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime_video/([^/]+)/trackback/?$] => index.php?veda_video=$matches[1]&tb=1
        [anime_video/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video=$matches[1]&feed=$matches[2]
        [anime_video/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video=$matches[1]&feed=$matches[2]
        [anime_video/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_video=$matches[1]&paged=$matches[2]
        [anime_video/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_video=$matches[1]&cpage=$matches[2]
        [anime_video/([^/]+)(/[0-9]+)?/?$] => index.php?veda_video=$matches[1]&page=$matches[2]
        [anime_video/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime_video/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime_video/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_video/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_video/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime_purchase/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime_purchase/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime_purchase/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_purchase/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_purchase/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime_purchase/([^/]+)/trackback/?$] => index.php?veda_purchase=$matches[1]&tb=1
        [anime_purchase/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_purchase=$matches[1]&feed=$matches[2]
        [anime_purchase/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_purchase=$matches[1]&feed=$matches[2]
        [anime_purchase/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_purchase=$matches[1]&paged=$matches[2]
        [anime_purchase/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_purchase=$matches[1]&cpage=$matches[2]
        [anime_purchase/([^/]+)(/[0-9]+)?/?$] => index.php?veda_purchase=$matches[1]&page=$matches[2]
        [anime_purchase/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime_purchase/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime_purchase/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_purchase/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime_purchase/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime-review/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime-review/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime-review/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-review/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-review/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [anime-review/([^/]+)/trackback/?$] => index.php?veda_review=$matches[1]&tb=1
        [anime-review/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_review=$matches[1]&feed=$matches[2]
        [anime-review/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_review=$matches[1]&feed=$matches[2]
        [anime-review/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_review=$matches[1]&paged=$matches[2]
        [anime-review/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?veda_review=$matches[1]&cpage=$matches[2]
        [anime-review/([^/]+)(/[0-9]+)?/?$] => index.php?veda_review=$matches[1]&page=$matches[2]
        [anime-review/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
        [anime-review/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [anime-review/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-review/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [anime-review/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [subtitle_language/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_subtitle_language=$matches[1]&feed=$matches[2]
        [subtitle_language/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_subtitle_language=$matches[1]&feed=$matches[2]
        [subtitle_language/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_subtitle_language=$matches[1]&paged=$matches[2]
        [subtitle_language/([^/]+)/?$] => index.php?veda_subtitle_language=$matches[1]
        [audio_language/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_audio_language=$matches[1]&feed=$matches[2]
        [audio_language/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_audio_language=$matches[1]&feed=$matches[2]
        [audio_language/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_audio_language=$matches[1]&paged=$matches[2]
        [audio_language/([^/]+)/?$] => index.php?veda_audio_language=$matches[1]
        [genre/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_genre=$matches[1]&feed=$matches[2]
        [genre/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_genre=$matches[1]&feed=$matches[2]
        [genre/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_genre=$matches[1]&paged=$matches[2]
        [genre/([^/]+)/?$] => index.php?veda_genre=$matches[1]
        [studio/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_studio=$matches[1]&feed=$matches[2]
        [studio/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_studio=$matches[1]&feed=$matches[2]
        [studio/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_studio=$matches[1]&paged=$matches[2]
        [studio/([^/]+)/?$] => index.php?veda_studio=$matches[1]
        [content_type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_content_type=$matches[1]&feed=$matches[2]
        [content_type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_content_type=$matches[1]&feed=$matches[2]
        [content_type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_content_type=$matches[1]&paged=$matches[2]
        [content_type/([^/]+)/?$] => index.php?veda_content_type=$matches[1]
        [publisher/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_publisher=$matches[1]&feed=$matches[2]
        [publisher/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_publisher=$matches[1]&feed=$matches[2]
        [publisher/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_publisher=$matches[1]&paged=$matches[2]
        [publisher/([^/]+)/?$] => index.php?veda_publisher=$matches[1]
        [release_type/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release_type=$matches[1]&feed=$matches[2]
        [release_type/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_release_type=$matches[1]&feed=$matches[2]
        [release_type/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_release_type=$matches[1]&paged=$matches[2]
        [release_type/([^/]+)/?$] => index.php?veda_release_type=$matches[1]
        [release_rating/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_rating=$matches[1]&feed=$matches[2]
        [release_rating/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_rating=$matches[1]&feed=$matches[2]
        [release_rating/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_rating=$matches[1]&paged=$matches[2]
        [release_rating/([^/]+)/?$] => index.php?veda_rating=$matches[1]
        [video_source/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video_source=$matches[1]&feed=$matches[2]
        [video_source/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_video_source=$matches[1]&feed=$matches[2]
        [video_source/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_video_source=$matches[1]&paged=$matches[2]
        [video_source/([^/]+)/?$] => index.php?veda_video_source=$matches[1]
        [retailer/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_retailer=$matches[1]&feed=$matches[2]
        [retailer/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?veda_retailer=$matches[1]&feed=$matches[2]
        [retailer/([^/]+)/page/?([0-9]{1,})/?$] => index.php?veda_retailer=$matches[1]&paged=$matches[2]
        [retailer/([^/]+)/?$] => index.php?veda_retailer=$matches[1]
        [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [content/[^/]+/[^/]+/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [content/([^/]+)/([^/]+)/([^/]+)/trackback/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&tb=1
        [content/([^/]+)/([^/]+)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&feed=$matches[4]
        [content/([^/]+)/([^/]+)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&feed=$matches[4]
        [content/([^/]+)/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&paged=$matches[4]
        [content/([^/]+)/([^/]+)/([^/]+)(/[0-9]+)?/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&name=$matches[3]&page=$matches[4]
        [content/[^/]+/[^/]+/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
        [content/[^/]+/[^/]+/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [content/[^/]+/[^/]+/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [content/[^/]+/[^/]+/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [content/[^/]+/[^/]+/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [content/([^/]+)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&feed=$matches[3]
        [content/([^/]+)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&feed=$matches[3]
        [content/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]&paged=$matches[3]
        [content/([^/]+)/([^/]+)/?$] => index.php?seriesname=$matches[1]&contenttype=$matches[2]
        [content/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&feed=$matches[2]
        [content/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?seriesname=$matches[1]&feed=$matches[2]
        [content/([^/]+)/page/?([0-9]{1,})/?$] => index.php?seriesname=$matches[1]&paged=$matches[2]
        [content/([^/]+)/?$] => index.php?seriesname=$matches[1]
        [robots\\.txt$] => index.php?robots=1
        [.*wp-atom.php$] => index.php?feed=atom
        [.*wp-rdf.php$] => index.php?feed=rdf
        [.*wp-rss.php$] => index.php?feed=rss
        [.*wp-rss2.php$] => index.php?feed=rss2
        [.*wp-feed.php$] => index.php?feed=feed
        [.*wp-commentsrss2.php$] => index.php?feed=rss2&withcomments=1
        [feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]
        [(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]
        [page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]
        [comments/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]&withcomments=1
        [comments/(feed|rdf|rss|rss2|atom)/?$] => index.php?&feed=$matches[1]&withcomments=1
        [comments/page/?([0-9]{1,})/?$] => index.php?&paged=$matches[1]
        [search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?s=$matches[1]&feed=$matches[2]
        [search/(.+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?s=$matches[1]&feed=$matches[2]
        [search/(.+)/page/?([0-9]{1,})/?$] => index.php?s=$matches[1]&paged=$matches[2]
        [search/(.+)/?$] => index.php?s=$matches[1]
        [author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2]
        [author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?author_name=$matches[1]&feed=$matches[2]
        [author/([^/]+)/page/?([0-9]{1,})/?$] => index.php?author_name=$matches[1]&paged=$matches[2]
        [author/([^/]+)/?$] => index.php?author_name=$matches[1]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]
        [([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
        [([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]
        [([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]
        [([0-9]{4})/([0-9]{1,2})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]
        [([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&feed=$matches[2]
        [([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&feed=$matches[2]
        [([0-9]{4})/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&paged=$matches[2]
        [([0-9]{4})/?$] => index.php?year=$matches[1]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/trackback/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&tb=1
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&feed=$matches[5]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/page/?([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&paged=$matches[5]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&cpage=$matches[5]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/([^/]+)(/[0-9]+)?/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&name=$matches[4]&page=$matches[5]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/?$] => index.php?attachment=$matches[1]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [[0-9]{4}/[0-9]{1,2}/[0-9]{1,2}/[^/]+/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&cpage=$matches[4]
        [([0-9]{4})/([0-9]{1,2})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&monthnum=$matches[2]&cpage=$matches[3]
        [([0-9]{4})/comment-page-([0-9]{1,})/?$] => index.php?year=$matches[1]&cpage=$matches[2]
        [.+?/attachment/([^/]+)/?$] => index.php?attachment=$matches[1]
        [.+?/attachment/([^/]+)/trackback/?$] => index.php?attachment=$matches[1]&tb=1
        [.+?/attachment/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [.+?/attachment/([^/]+)/(feed|rdf|rss|rss2|atom)/?$] => index.php?attachment=$matches[1]&feed=$matches[2]
        [.+?/attachment/([^/]+)/comment-page-([0-9]{1,})/?$] => index.php?attachment=$matches[1]&cpage=$matches[2]
        [(.+?)/trackback/?$] => index.php?pagename=$matches[1]&tb=1
        [(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$] => index.php?pagename=$matches[1]&feed=$matches[2]
        [(.+?)/(feed|rdf|rss|rss2|atom)/?$] => index.php?pagename=$matches[1]&feed=$matches[2]
        [(.+?)/page/?([0-9]{1,})/?$] => index.php?pagename=$matches[1]&paged=$matches[2]
        [(.+?)/comment-page-([0-9]{1,})/?$] => index.php?pagename=$matches[1]&cpage=$matches[2]
        [(.+?)(/[0-9]+)?/?$] => index.php?pagename=$matches[1]&page=$matches[2]
    )
    
    %seriesname%是一个slug,与帖子的父级一致。%contenttype%与自定义分类法一致。其想法是,如果省略了%postname%标记,则可以使用这两个其他标记创建存档页。

    编辑:取得进展。正如评论中讨论的那样,使用内置的%postname%标记和自定义的permastruct似乎是导致我400个错误请求的原因。希望这能缩小问题的范围。

  • 1 个回复
    最合适的回答,由SO网友:Manny Fleurmond 整理而成

    好吧,我觉得自己很笨。

    我需要翻译%postname%。我认为它是自动完成的,因为管理页面看起来像它一样,但显然如果你使用自定义的permastructs,你甚至必须翻译默认的标记。

    我的解决方案:将此添加到我的post\\u type\\u链接筛选器:

    $post = get_post($post_id);
    $permalink =  str_replace(\'%postname%\', $post->post_name, $permalink);
    
    问题已解决。

    结束

    相关推荐

    curl problem or permalinks

    我刚刚配置了我的VPS,我使用的是Centos,一切都很好,但如果我将永久链接设置为自定义结构,然后接受主页,没有帖子出现,它会显示404页,我想这是因为我没有启用curl,但我不知道我的php在哪里。我的centos中的ini文件?好的,我的卷曲被启用了,我检查过了phpinfo(); 这里是URLhttp://74.117.158.182/info.php但如果我在我的wordpress中设置了永久链接,那么接受主页,所有都会给我404页,你可以在这个URL上查看http://mbas.co.in如果