如何编写下面给出的url重写规则链接。
-
匹配页面的原始url:
http://www.cricmelive.tv/live/09876/barisal_bulls_vs_chittagong_vikings_t20
现在需要的网址:
http://www.cricmelive.tv/live/09876/barisal_bulls_vs_chittagong_vikings_t20
2.频道类别的原始url:
http://www.cricmelive.tv/live/category.php?id=1
现在需要的url为:
http://www.cricmelive.tv/live/sports
3.Sports Catgry的原始网址:
http://www.cricmelive.tv/live/index.php?catid=1
现在需要的url为:
http://www.cricmelive.tv/live/cricket
4.频道页面的原始url:
http://www.cricmelive.tv/live/channel-page.php?cid=45
现在需要作为:
http://www.cricmelive.tv/live/espn-3-live-streaming
我是你重写的新手。我又发了一遍。帮助我,如何再次编写重写url代码原始url
我看到你在尝试做什么,但它不起作用。querystring中的参数在sql的后端使用,以使用$_GET
查找数据库中的相关记录。
catid=45
不会直接转换为cricket
——在数据库中,catid=1
可能是cricket
,但Web服务器不知道这种关系,因此您需要更改sql查询,使其使用cricket
作为where子句中的参数,而不是1。
例如:
http://www.cricmelive.tv/live/1
that could be expressed easily with a rewrite rule, such as:
RewriteRule ^live/([0-9]+)$ live/index.php?catid=$1 [NC,L]
select * from table where category='cricket'
RewriteRule ^live/([0-9a-zA-Z]+)$ live/index.php?category=$1 [NC,L]