douzinei6926 2010-01-24 14:10
浏览 43
已采纳

htaccess mod_rewrite: - products.php?cat = 1 to / myfolder1 / myproduct1 /

I've got a url type:- http://www.example.com/products.php?cat=1 which I am able to rewrite to:- http://www.example.com/myproduct1 using the following .htaccess rule:- RewriteRule ^myproduct1$ products.php?cat=1.

What rule would I need to enter if I wanted to rewrite to:- http://www.example.com/myfolder1/myproduct1/?

  • 写回答

2条回答 默认 最新

  • duan0513 2010-01-24 14:17
    关注

    For any arbitrary path segments a and b in /a/b/, you can use this:

    RewriteRule ^([^/]+)/([^/]+)/$ products.php?segment1=$1&segment2=$2
    

    Edit    In response to your comment: Just put good/boy in your pattern:

    RewriteRule ^good/boy$ products.php?cat=1
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用