【发布时间】:2015-11-13 20:09:03
【问题描述】:
我在 wordpress 中有一个页面,我正在使用一个名为 Bad-Debt-Recovery-in/ 的 slug。我在该页面上使用自定义 php 查询,URL 中的字符串如下所示
Bad-Debt-Recovery-in/?zipcode=55555&location=Chambers%20County+AL
我怎样才能把这个网址变成这样的蛞蝓
Bad-Debt-Recovery-in/55555/Chambers-County/AL/
作为重写?任何帮助将不胜感激!
更新: 这段代码实际上是我正在使用的。我还让它变得更简单,并创建了第三个名为“state”的变量。一种是针对城市的,一种是针对县页面的:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^Bad-Debt-Recovery-And-Collection-Agencies-Services-In\/([^\/]+)\/([^\/]+)\/([^\/]+)\/? Bad-Debt-Recovery-And-Collection-Agencies-Services-In/?zipcode=$1&city=$2&state=$3 [QSA,L,NC]
RewriteRule ^Bad-Debt-Recovery-And-Collection-Agency-Services-In\/([^\/]+)\/([^\/]+)\/([^\/]+)\/? Bad-Debt-Recovery-And-Collection-Agency-Services-In/?countyid=$1&county=$2&state=$3 [QSA,L,NC]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</IfModule>
# END WordPress
【问题讨论】:
-
请添加您的代码
-
我根据“Scriptonomy”解释添加了我的代码。它仍然无法正常工作。我可能做错了什么。