mod_rewrite 子域 +目录
我很羞愧不得不问这个问题,因为关于这个问题有太多的问题和答案,但我已经搜索并尝试了数周,但没有得到积极的结果。
我有文件上传页面,网址为: files.example.com
当用户上传放置在子目录中的文件时: files.example.com/files/file.jpg 因此,当用户要查看该文件时,他必须访问该 url。
但我想删除目录文件/ 因此用户可以使用以下 url 查看该文件: files.example.com/file.jpg
我已将 .htaccess 文件放置在: files.example.com/.htaccess
并尝试了我能找到的一切。例如:
RewriteEngine On
RewriteBase /
RewriteRule ^files/?(.*)$ /$1
mod_rewrite 子域 + 目录
I'm ashamed for having to ask this becous there is soooo many questions and answers out there about this but I have search and tried for weeks without positive results.
I have file upload page with the url:
files.example.com
When a user is uploading a file its placed in a subdir:
files.example.com/files/file.jpg
So when a user is going to view the file, he has to visit that url.
But I want to remove the dir files/
So the user can view the file with this url:
files.example.com/file.jpg
I have placed a .htaccess file in:
files.example.com/.htaccess
And tried everything i can find. Ex.:
RewriteEngine On
RewriteBase /
RewriteRule ^files/?(.*)$ /$1
mod_rewrite subdomain + dir
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的规则是扭曲的。尝试:
Your rule is the wring way round. Try: