.htaccess重写问题
我想要它,以便目录中的任何 swf 媒体都被重定向到一个文件,例如
http://website.com/swf.php?d=file
然后抛出 http 访问,将上面的链接更改为
http://website.com/file
文件
http://website.com/thisvideo.swf
所以让我们假设我有我希望它重定向到的 http://website.com/swf.php?d=thisvideo.swf
但是使用 .htaccess 将上面的链接更改为 http://website.com/thisvideo.swf
因此,当他们访问 thisvideo.swf 时,它不会转到直接 swf 但包含查询的 php 文件(假设通过 .htaccess 隐藏)。
我希望你明白我想说的,但我不知道如何做第一步重定向(如果是 swf)或重写。
I want it so that any swf media in a directory gets redirected to a file like
http://website.com/swf.php?d=file
Then threw http access, change the link above to
http://website.com/file
so lets assume I have the file
http://website.com/thisvideo.swf
I want it to redirect to
http://website.com/swf.php?d=thisvideo.swf
BUT with .htaccess change the above link to
http://website.com/thisvideo.swf
So when they visit thisvideo.swf it doesnt go to the direct swf but the php file with the query in it (assuming thats hidden via the .htaccess).
I hope you get what im trying to say, but I don't know how to do the first step of redirecting if its swf, or rewriting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应该很简单:
这基本上是说“获取带有
.swf
扩展名的任何 URL,保持其 URL 相同(屏蔽它),并将请求转发到script.php
。编辑:如果您想严格控制它,您可以在
RewriteEngine On
: 下面添加以下内容,这将强制它仅重写有效文件(例如,您不会重定向任何 404)。
Should be simple:
This basically says "take any URL with a
.swf
extension, keep its URL the same (mask it), and forward the request toscript.php
.Edit: if you want to be strict about it, you could add the following immediately below
RewriteEngine On
:which will force it only to rewrite valid files (eg, you wouldn't be redirecting any 404's).