【问题标题】:htaccess wildcard subdomain redirect with https non wwwhtaccess 通配符子域重定向与 https 非 www
【发布时间】:2018-08-10 05:48:23
【问题描述】:

我已经搜索并搜索无济于事。如果已经有答案,请告诉我。

但我正在尝试使用 GET 请求将通配符子域重定向到特定文件。同时需要重定向到https和非WWW

例如:
http://user1.example.com -> https://example.com/index.php?user=user1 https://user2.example.com -> http://example.com/index.php?user=user2

任何帮助将永远感激,并提前感谢您!

【问题讨论】:

    标签: php .htaccess https subdomain wildcard


    【解决方案1】:

    试试下面的规则,

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(.*)\.example.com
    RewriteRule ^ %{REQUEST_SCHEME}://example.com/index.php?user=%1 [R=302,END]
    

    我有点不确定请求方案是否可以在较低版本的 apache 中工作,请告诉我结果。

    【讨论】:

      猜你喜欢
      • 2019-01-23
      • 2014-11-12
      • 1970-01-01
      • 1970-01-01
      • 2016-10-22
      • 1970-01-01
      • 2015-05-19
      • 2016-03-28
      • 2018-06-02
      相关资源
      最近更新 更多