douwu8251 2013-11-20 04:37
浏览 48
已采纳

为文件创建自定义URL以隐藏其位置

So I'm using the jQuery File Upload plugin to stream videos on my site. I'm just having a bit of problems.

So I've created a database that stores some of the details of the video that is uploaded, example: size, random and unique id, description, and some other things.

Now, I want to create a page for each video that is uploaded. I can easily do this through a .php file that just grabs the file location, and so on. However, how can I make it so that when users try to access a specific video they can type in something like this in the url

mysite.com/video/random_video_id

Then grab the random_video_id from the URL and use it in my PHP script to display necessary content on the page.

I just want to know how I can make custom urls like mysite.com/video/random_video_id that will trigger the php script that will generate the content of the page.

  • 写回答

1条回答 默认 最新

  • dongxiaoxing3058 2013-11-20 04:51
    关注

    you need to use .htaccess for making the pretty url you want use...

    if you make a url mysite.com/index.php?action=video&id=random_video_id ... I assume you know how you use $_GET and basic PHP, so I wouldn't go into the coding of the script which retrieves the videoes...

    I use this site to make my .htaccess files - http://searchfriendlyurls.com/

    And then you just write your domain in the first input (Domain Name) and in the second (ugly url) you write "index.php?action=&id=" and in the last (pretty url) you write "/"

    Hope this helps you ...

    And if you want to learn more about .htacces look here

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

报告相同问题?

悬赏问题

  • ¥15 前端echarts坐标轴问题
  • ¥15 CMFCPropertyPage
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题
  • ¥15 谁会P4语言啊,我想请教一下
  • ¥15 这个怎么改成直流激励源给加热电阻提供5a电流呀
  • ¥50 求解vmware的网络模式问题 别拿AI回答
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳