i have a website SongsBar.com , when a query is searched on my website, the url in the browser displays like this - http://songsbar.com/download.php?q={search text}. i want it be appear like this http://songsbar.com/download/{search text}.html
4条回答 默认 最新
- douya1248 2014-01-16 23:25关注
First, you need to make sure Multiviews (mod_negotiation) is turned off, otherwise it'll mess with the
/download/
and/download.php
stuff.Then you need to externally redirect requests for
download.php
Then you need to internally rewrite the
/download/
requests back to the php file (the browser is oblivious to this happening.Options -Multiviews RewriteEngine On RewriteCond %{THE_REQUEST} \ /+download.php\?q=([^&\ ]+) RewriteRule ^ /download/%1.html? [L,R=301,NE] RewriteRule ^download/(.+)\.html$ /download.php?q=$1 [L,B,QSA]
The
B
flag may not be necessary. It depends on what kind of stuff you plan on putting in the parameter. The flag ensures that special characters get encoded.本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 不是,这到底错哪儿了😭
- ¥15 2020长安杯与连接网探
- ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
- ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
- ¥16 mybatis的代理对象无法通过@Autowired装填
- ¥15 可见光定位matlab仿真
- ¥15 arduino 四自由度机械臂
- ¥15 wordpress 产品图片 GIF 没法显示
- ¥15 求三国群英传pl国战时间的修改方法
- ¥15 matlab代码代写,需写出详细代码,代价私