这是我的网址正确nowm我的产品
This are my urls right nowm for my products
www.example/product.php?product=32723
我想实现这个
www.example/product/32723-brand-模型产品名
我一直在修改我的.htaccess但真的就如何实现这一目标没有头绪。
I have been modifying my .htaccess but really with no clue on how to achieve this.
推荐答案您必须将网址与的 重写规则 模式和重写到目标URL
You must match your URL with a RewriteRule pattern and rewrite it to the target URL
RewriteRule ^/product/(\d+)- /product.php?product=$1这个模式匹配开头 /产品/ 的任何URL,并抓住了以下数字(\ d +)之后破折号 - 。替换URL将是 /product.php?product = 与所捕获的数字 $ 1 追加。
This pattern matches any URL starting with /product/ and captures the following digits (\d+) followed by a dash -. The substitution URL will be /product.php?product= with the captured digits $1 appended.
要捕捉比赛的某些部分,你将它用括号(...)。了解更多关于在mod_rewrite的在 URL重写简介经常使用前pressions - 普通防爆pressions 。
To capture some part of the match, you enclose it in parenthesis (...). Read more on regular expressions used in mod_rewrite at Apache mod_rewrite Introduction - Regular Expressions.
更多推荐
如何创建使用.htacces modrewrite更好网址
发布评论