dpqaaczn141761 2012-04-20 21:09
浏览 19
已采纳

URL重写无法正常工作

This is my URL rewrite:

RewriteRule ^cars/$ cars.php    
RewriteRule ^cars/([a-z-]+)/$ /cars.php?model=$1

This works, so my URL is like this:

example.com/cars/porche/

refers to

cars.php?model=porche

Now Im making more search criterias, so I want to be able to add for example model year, car manufactor, etc. like this:

example.com/cars/porche/?model_year=xxx&car_manufactor=xxx

Right now this does not work with the current rewrite, but I can't figure out why.

  • 写回答

1条回答 默认 最新

  • dongsi7759 2012-04-20 21:10
    关注

    Simple, just add QSA:

    RewriteRule ^cars/([a-z-]+)/$ /cars.php?model=$1 [QSA]
    

    That tells the rewrite engine to append any other query parameters to the rewritten URL as well.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services