【发布时间】:2016-04-28 07:28:30
【问题描述】:
我的原始网址是什么样的:
localhost/aoc/product.php?pid=2&cname=australia
应用Htaccess:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /aoc
RewriteRule ^product-category/([A-Za-z0-9_\-]+)/([A-Za-z0-9_\-]+).html product.php?pid=$1&cname=$2
结果网址:
localhost/aoc/product-category/1/australia.html
但我面临的问题是如何传递参数来对页面项目进行排序。例如,让我想传递变量 ?sort=xxx 或 &sort=xxx. 如何通过编辑 htaccess 以最佳方式实现?
localhost/aoc/product-category/1/australia.html?sort=xxx - Not working
localhost/aoc/product-category/1/australia.html&sort=xxx - Not working
我不希望下面看起来难看但在编辑 htaccess 后可以工作的组合:
http://localhost/aoc/product-category/1/xxx/australia.html
http://localhost/aoc/product-category/1/australia.html/xxx/
请帮我解释一下。
【问题讨论】:
标签: php apache .htaccess mod-rewrite url-rewriting