【问题标题】:wordpress htaccess rewriterulewordpress htaccess 重写
【发布时间】:2012-04-10 09:10:45
【问题描述】:

我的 wordpress .htaccess 文件看起来像

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

我想添加我的 owm rewriterule 但不工作 规则必须重写 page/([a-z,A-Z]+).html$ 到 pages?page_name=$1

【问题讨论】:

  • 你试过什么没用?

标签: wordpress .htaccess mod-rewrite


【解决方案1】:

这是按照您的要求做的规则:

RewriteRule ^page/([a-z,A-Z]+).html$ pages?page_name=$1 [NC]

把它放在RewriteRule . /index.php [L] 之后就可以了。

【讨论】:

  • 它只有在以下情况下才开始工作:1 - 在 RewriteRule ^page/([a-z,A-Z]+).html$ pages?page_name=$1末尾添加 [NC,L] >
【解决方案2】:

它只有在以下之后才开始工作:

  1. 在我的 RewriteRule 末尾添加 [NC,L]

  2. 使用绝对路径http://site.ru/pages?page_name=$1

【讨论】:

    【解决方案3】:

    我也推荐你阅读this post 它展示了如何将您的自定义重写器添加到 WP

    【讨论】:

      猜你喜欢
      • 2014-09-23
      • 2012-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-09
      • 2018-03-08
      • 2011-10-16
      相关资源
      最近更新 更多