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. At the same time need to redirect to https and non 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
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.