[英]htaccess rewrite rule to redirect .mp3 extension
I am trying to make a rewrite rule that will rewrite this: 我试图制定一个重写规则,将其重写为:
example.com/audio.mp3
To this: 对此:
example.com/stats.php?file=audio.mp3
I have: 我有:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ file.php?file=$1 [QSA]
This is working as long as I don't add a file extension to the URL. 只要我不向URL添加文件扩展名,此方法就可以正常工作。 As soon as I do, I get a 404 not found page.
这样做后,我立即得到一个404未找到页面。
What's wrong? 怎么了?
如果将其放在其他代码行之上,我相信它应该可以工作:
RewriteRule ^(.*)\.mp3$ /stats.php?file=$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.