dongzuo4666 2015-02-08 15:32
浏览 20

友好的网址.htaccess文件

I have a problem here I'v fixed a friendly url.

I am using two folders in my website one is root folder itself and another one is in 'customer' folder I have fixed in rout folder and it is working fine now in inside customer folder it is not working fine.

In my root folder I have many PHP files and it is having a search also eg:

mydomain.com/contact-us.php
mydomain.com/about-us.php

mydomain.com/business-details.php?id=1

for the above one I hv changed like this

mydomain.com/business-details/1

Now in sub folder 'customer' I have two parameter

Eg:

mydomain.com/customer/index.php?place=bangalore&business-name=business-name

I want to change it like this

mydomain.com/bangalore/business-name

is it possible? am stuck seeking kind help

  • 写回答

1条回答 默认 最新

  • dongqiang2024 2015-02-08 18:13
    关注

    You can use mod_rewrite to examine query strings as well as other parts of the URL.

    If your URL always looks like your example, then you could use something like:

    RewriteCond %{QUERY_STRING} ^place=([^&]+)&business-name=(.*)$
    RewriteRule ^/customer/index.php /%1/%2
    

    The RewriteCond examines the query string and picks out the place and business name, putting them in variables. Then the RewriteRule rewrite the URL according to what you say you want.

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么