doucang5542 2013-04-29 16:11
浏览 45
已采纳

重写URL,从子域到另一个子域

Im try find good solution to hide real streaming url, im try with php but have problems with stream in that way like

http://site.com/player/stream.php?p=[file path]&f=filename.flv&t=<? echo md5(session_id().$_SERVER['REMOTE_ADDR'])?>

Maybe rewrite url with htaccess is better solution? something like this

http://media.site.com/videos/0412/125843213/125843213.flv [org. file]

rewrite to

http://s1.media.site.com/0412/125843213.flv

.. any idea how to make this? or maybe is better to back on php...?

  • 写回答

2条回答 默认 最新

  • douan2478 2013-04-29 17:01
    关注

    In your htaccess file in the root directory, or from your apache configuration:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^videos/(\d+)/(\d+)/(\d+)\.flv$ http://s1.media.site.com/\1/\3.flv [R=301,L,QSA]
    

    Having said that, once you have a rewrite, then your 'real url' that you want to hide has become the rewritten url. You will be able to access the file using either url. Basically, one of the urls to access the file will still be accessible by any users, so it's not any more secure.

    Also, because of the host change, you will be sending 2 times the number of requests to your servers.

    Good reasons to use rewrite:

    • SEO
    • Single entry point (like in CakePHP, CodeIgniter, etc - index.php)
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看