【发布时间】:2017-11-30 11:59:57
【问题描述】:
我正在使用 wordpress 创建一个求职网站。我想创建一个自定义 .htaccess 规则,这样当用户在表单中搜索作业时,第一部分将作为文件夹结构,其余部分将作为查询参数添加。
只有当我们查询参数 ?find= any-value be in url 时才会这样 休息页面想要的样子 http://example.com/contact/
我想要:-
http://example.com/?find=any-value&job_location=Austin,TX&findjobs=Search
变成:-
http://example.com/any-value?job_location=Austin,TX&findjobs=Search
我的永久链接设置如下:-
http://example.com/sample-post/
QA .htaccess 代码
# Special redirects
RewriteCond %{QUERY_STRING} ^find=([^/]*)$
RewriteRule ^/?$ /%1\/? [R=301,L]
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
【问题讨论】:
标签: wordpress .htaccess url-rewriting