Redirect subdomain request to subdirectory + https (using .htaccess)
I have some problems with .htaccess
that I just can't seem to work with. Hope someone can fix this problem.
I have an SSL certificate on a www.-domain on an Apache server. I want all requests http://subdomain.domain.com
in the specified list of subdomains to be redirected to https://www.domain.com/subdomain
.
The second problem is that I don't have a wildcard certificate that works on non-www. queries, queries https://subdomain.domain.com
will result in a "Wrong connection" warning . So this also needs to be addressed, but perhaps it requires a different type of redirect?
What terms and conditions can achieve these two requirements using .htaccess
?
source to share
If you use mod-rewrite, the user will be shown that they are using subdomain.domain.com and the actual files are served by the web server from www.domain.com/subdomain. unfortunately the webserver will send the ssl certificate to www.domain.com which will result in a domain mismatch and cause a user complaint. there is nothing you can do about it.
one option should be clean for your users and just redirect them to www.domain.com/subdomain instead of rewriting your requests. you can use the Apache Redirect directive to do this, or you can just send the Location: header back from the placeholder html file.
source to share