【问题标题】:/blog for the Blog listing and /blog/%postname% for the Blog Post, mod_rewrite rule/blog 用于博客列表,/blog/%postname% 用于博客文章,mod_rewrite 规则
【发布时间】:2016-11-18 16:58:08
【问题描述】:

我目前正在开发一个站点,该站点需要站点名称/博客用于博客列表页,站点名称/博客/%postname$ 用于博客帖子。

我当前的 mod_rewrite 规则如下。

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule ^(.*)\/blog/        /blog/  [R=301,L]

任何,如何使这成为可能?

【问题讨论】:

  • 不要乱用.htaccess,这些是基本的 WordPress 设置。

标签: php wordpress apache .htaccess mod-rewrite


【解决方案1】:
  1. 添加带有 slug blog 的空白页;标题不必相同。
  2. 转到设置>自定义>静态首页>帖子页面并选择您刚刚添加的页面。
  3. 如果前者不正确,请转到 Settings > Permalinks 并选择 Post name 或在 Custom structure 中使用 /blog/%postname%/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-18
    • 1970-01-01
    • 2013-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多