0

I am using Wamp and i am new to url rewriting what i want to do is to convert this

localhost/webtv/video/?ID=14&CH=30

To:

localhost/webtv/channel name/video title/

where /webtv/ = the root of my website on localhost and ID = the video id and CH = the channel id

Do i have to query the titles of the video and the channel or what and whatever solution you will give me will work on locahost as on the server ?

Thank you so much

4

1 回答 1

0

是的,您需要查询标题和频道表单 url 而不是 id。用户如何知道您表中视频的 id。可以反向获取视频的标题并与 mysql 表中的 id 匹配。

对于 url 重写,请确保您已在 wamp 中启用 mod_rewrite

获取视频标题和频道的网址是

localhost/webtv/video/?channel=channel_name&video=video_title

在 .htaccess 中写下面的代码。

RewriteRule webtv/(.*)/(.*)/?$ /webtv/video/?channel=$1&video=$2

将 htaccess 放在根(即)www 目录中。

于 2013-11-10T11:11:39.600 回答