Wordpress中的特殊重写规则

时间:2015-07-10 13:36:14

标签: wordpress apache .htaccess mod-rewrite

在我的wordpress安装中,我有一个特殊的页面,可以从外部数据库中获取数据。

如果我打开http://localhost/o-b/comm/?id=123 everthing工作正常。但如果我打开http://localhost/ob/comm/123 Wordpress会引导我进入404错误页面。我已经通过在线重写规则检查检查了RewriteRule并获得了匹配。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^ob/comm/(.*)$ o-b/comm/?id=$1 #this line is killing me

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

有关于此的任何提示吗?

1 个答案:

答案 0 :(得分:0)

转到WordPress信息中心设置下的永久链接选项,找到执行此操作的选项。

不确定变量&#34; id&#34;这里的意思是,因为它通常是&#34; p&#34;,如果这是自定义帖子类型,则需要为其启用网址重写。

在这里阅读更多内容: https://codex.wordpress.org/Using_Permalinks