.htaccess修改
我使用直接路径从我的网站下载文件。该链接是这样的
http://www.site.com /download.php?dir1/dir/dir3/file.doc
我想用 mod 重写规则包装它,以便只显示下面的链接
文件,dir 和 dir3 是变量。 我要在 .htaccess 文件中做什么?有什么想法吗?
I am using direct paths for downloading files from my site. the link is something like this
http://www.site.com/download.php?dir1/dir/dir3/file.doc
i want to wrap it with mod rewite rules so that only below link should be appeared
file, dir and dir3 are variable.
what i'hv to do in my .htaccess file?? Any Idea??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个简单的重定向是:
这将接受对“人工”下载目录中某些内容的任何请求,并将其路由到真实位置。
您可以根据您的需要添加更复杂的规则,去除文件类型等,或者将“名称”重定向到文件名等。
例如:
这将有一个包含文件名(扩展名)的人工 PDF 文件夹,路由到 .pdf 文档....您可以按照您喜欢的任何方式塑造重定向...取决于您喜欢的格式
A simple redirect would be:
This will take any request for something in the 'artificial' download directory and route it to the real location.
You can add more complex rules stripping out filetypes etc depending on your needs, or redirecting a 'name' to a filename etc etc..
e.g:
This would have an artificial PDF folder containing a filename ex the extension, routing to a .pdf doc....you can shape the redirect any way you like really...depends on the format you prefer
不是具体问题。
dir1/dir/dir3/file.doc
是什么意思?如果您想获取http://www.site.com/download.php?dir1/dir/dir3/file.doc
,当您访问http://www.site .com/download
在 .htaccess 文件中执行接下来的操作。Not specific question. What is
dir1/dir/dir3/file.doc
means? If you want to gethttp://www.site.com/download.php?dir1/dir/dir3/file.doc
, when you go tohttp://www.site.com/download
do the next things in your .htaccess file.