如何使用htaccess重写这个url?
我有这个网址, http://website.com/?slug=product_info.php& products_id=28
并想将其重写为: http://website.com/page/product_info/product_id/28
如何执行此操作使用htaccess或wordpress的“wp_rewrite”功能?
谢谢。
I have this url, http://website.com/?slug=product_info.php&products_id=28
and wanted to rewrite it to:
http://website.com/page/product_info/product_id/28
How to do this using the htaccess or the function "wp_rewrite" of wordpress?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 .htaccess 文件中,您可以尝试:
当您键入 http://website.htaccess 文件时,就会这样。 com/page/product_info/product_id/28 进入浏览器的地址栏,它会在服务器内部重写为
/?slug=product_info.php&products_id=28
。如果您的意思是其他方式,重写将如下所示:
因此,当您输入 http://website.com/?slug=product_info.php&products_id=28 进入浏览器的地址栏,它会在服务器内部重写进入
/page/product_info/product_id/28
。In the .htaccess file you can try:
This will make it so when you type http://website.com/page/product_info/product_id/28 into your browser's address bar, it gets rewritten internally on the server into
/?slug=product_info.php&products_id=28
.If you meant the other way around, the rewrite will look like this:
So this will make it so when you type http://website.com/?slug=product_info.php&products_id=28 into your browser's address bar, it gets rewritten internally on the server into
/page/product_info/product_id/28
.