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 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据