htaccess将动态mp3重写为动态php? [英] htaccess rewrite dynamic mp3 to dynamic php?

查看:71
本文介绍了htaccess将动态mp3重写为动态php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用htaccess,是否可以重写以下内容:

Using htaccess, is it possible to rewrite something like:

http://www.example.com/music.mp3?file= filname

http://www.example.com/mp3.php?file= filname

因此,当用户转到(music.mp3?file = filname)时,他将被重写为(music.php?mp3file = filname)...。

so when an user goes to ( music.mp3?file= filname ) he will be rewrite to ( music.php?mp3file= filname ) ....

推荐答案

此示例从 music.mp3?any-query music.mp3 发送请求code>到 music.php?any-query

this example send request from music.mp3?any-query or music.mp3 to a music.php?any-query

   RewriteEngine on
   RewriteRule ^music.mp3(.*)$ music.php$1 [r=301,L]

此示例将请求从 file-name.mp3 发送到 music.php?file = file-name

this example send request from file-name.mp3 to a music.php?file=file-name

   RewriteEngine on
   RewriteRule ^(.*).mp3$ music.php?file=$1 [r=301,L]

这篇关于htaccess将动态mp3重写为动态php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆