using apache#39;s mod_rewrite to parse SEO friendly URL#39;s(使用 apache 的 mod_rewrite 解析 SEO 友好的 URL)
本文介绍了使用 apache 的 mod_rewrite 解析 SEO 友好的 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何转换类似的东西
到
me.com/profile.php?id=24443
或类似的东西
me.com/store/24111/robert-adams
到
使用 mod_rewrite?
with mod_rewrite?
我也可以使用 mod_rewrite 进行反向转换,还是必须通过 PHP 解析?
Can I make the reverse conversion as well with mod_rewrite, or would I have to parse it through PHP?
推荐答案
这应该适用于两者:
说明:
您还可以使其更精确,以便仅重写两个请求并且仅接受数字作为 id:
You can also make it more precise so only the two request are rewritten and only digits are accepted as id:
这篇关于使用 apache 的 mod_rewrite 解析 SEO 友好的 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!