[英]htaccess wildcard subdomain redirect with https non www
I have searched and search to no avail. 我搜索了,但搜索无济于事。 If there is already an answer out there, please let me know.
如果已经有答案了,请告诉我。
But I am trying to redirect wildcard subdomains to a specific file with a GET request. 但是我正在尝试使用GET请求将通配符子域重定向到特定文件。 At the same time need to redirect to https and non WWW
同时需要重定向到https和非WWW
For Example: 例如:
http://user1.example.com -> https://example.com/index.php?user=user1
https://user2.example.com -> http://example.com/index.php?user=user2
http://user1.example.com -> https://example.com/index.php?user=user1
https://user2.example.com -> http://example.com/index.php?user=user2
Any help will be forever grateful and thank you in advance! 任何帮助将永远感激,并预先感谢您!
Try with below rule, 尝试以下规则,
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.*)\.example.com
RewriteRule ^ %{REQUEST_SCHEME}://example.com/index.php?user=%1 [R=302,END]
I am slightly unsure that request scheme will work in lower version of apache let me know the result. 我有点不确定请求方案是否可以在较低版本的apache中工作,请让我知道结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.