douhong4452 2017-06-04 22:06
浏览 33
已采纳

如何在子域中上传根域中的文件

I've a domain and a subdomain with this structure:

Domain: mydomain.com
Subdomain: m.mydomain.com (which "mydomain.com/mobile/" is the folder)

While I'm on mydomain.com, I upload images to the folder "images", this is the structure:

mydomain.com/images/image.jpg

And I've no problems with it, because the folder /images/ is in the domain.

Now, when I'm in m.mydomain.com, how can I upload images to the domain folder (mydomain.com/images) and not to the subdomain folder (m.mydomain.com/images)?

Thank you guys

PS. I'm using Routing with both domains, with the index.php as "router"

  • 写回答

1条回答 默认 最新

  • duanchun5520 2017-06-04 22:16
    关注
    1. Since m.domain.com is in domain.com you can use m.domain.com/images for both.

    2. Use the same directory for both domains and use .htaccess to route the mobile to index.m.php or something like that in the same directory.

    3. More complicated. You can serve files through a url page built in php. Basically just a page that takes the file name searches for it in the server directory outside the site and dumps the content with appropriate headers.

    4. Similar to 2 you can route both mobile and normal to the same directory. Detect in index.php if the subdomain is specified and load the site files from your mobile folder. This is my preferred method.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码