【问题标题】:Redirect All subdomain url to specific url using .htaccess使用 .htaccess 将所有子域 url 重定向到特定 url
【发布时间】:2011-10-16 04:41:17
【问题描述】:

如何改写

(anything).example.com/(anything)example.com/(anything)

例如:

img1.example.com/test1.jpgexample.com/test1.jpg

img105.example.com/anotherimage.pngexample.com/anotherimage.png

tdr.example.com/a.cssexample.com/a.css

【问题讨论】:

    标签: .htaccess mod-rewrite


    【解决方案1】:
    RewriteCond %{HTTP_HOST}  ^(.*)\.example.com$
    RewriteCond %{HTTP_HOST}  !^www\.example.com$
    RewriteRule ^(.*)$  http://www.example.com/$1 [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 2018-07-18
      • 2012-06-01
      • 2015-12-16
      • 2018-02-15
      • 2017-02-20
      • 1970-01-01
      • 1970-01-01
      • 2016-02-19
      • 2015-07-17
      相关资源
      最近更新 更多