【问题标题】:.htaccess mod rewrite folder to subdomain.htaccess mod 将文件夹重写到子域
【发布时间】:2012-11-20 09:34:37
【问题描述】:

所以我有主照片文件夹,我想使它成为子域样式 所以有 /images/ 和 /images/thumbs。我想要完成的事情 正在“转换”

/images/ -> images.domain.com 

/images/thumbs -> thumbs.domain.com

感谢您的帮助。

【问题讨论】:

    标签: .htaccess mod-rewrite subdomain directory


    【解决方案1】:
    RewriteRule ^/?images/thumbs/(.*)$  http://thumbs.domain.com/$1
    RewriteRule ^/?images/(.*)$   http://images.domain.com/$1  [L]
    

    此规则将以下 URL 重写为:http://domain.com/images/lol.pnghttp://images.domain.com/lol.png。 并且:http://domain.com/images/thumbs/lol.pnghttp://thumbs.domain.com/lol.png没有外部重定向。

    【讨论】:

    • 谢谢 你测试了吗?我似乎无法访问 images.domain.com 我也启用了 Options -Indexes 它会影响这个吗?它是否适用于典型的共享服务器(我使用 HG)。感谢您的宝贵时间。
    • 我无法测试 :-D 该选项对这些规则没有影响,但两个域都应该有保存服务器和 IP
    猜你喜欢
    • 2014-06-30
    • 1970-01-01
    • 2011-03-02
    • 2011-12-25
    • 2017-12-24
    • 2011-10-07
    • 1970-01-01
    • 1970-01-01
    • 2019-12-21
    相关资源
    最近更新 更多