i want https://www.kita-neukoelln.tandembtl.de/ go to https://kita-neukoelln.tandembtl.de/
it is only working with chrome and IE11, is there a way for other browser?
they check ssl for www.subdomain.domain.de before redirect :(
Thanks
RewriteCond %{HTTP_HOST} ^www\.kita-neukoelln.tandembtl\.de$ [NC]
RewriteRule (.*) https://kita-neukoelln.tandembtl.de/$1 [R=301,L]
Actually, I get a certificate error in every browser I've tried.
The problem, www.kita-neukoelln.tandembtl.de is a sub-subdomain and the security certificate for *.tandembtl.de does not cover it:
A wildcard SSL certificate for *.example.net will match
sub.example.net but not sub.sub.example.net.
is it possible to use ssl from main domain to be used on subdomain? Here is how domains are stored on vps server:
/domains/maindomain.com/public_html/somepagefiles
/domains/subdomain.maindomain.com/public_html/somepagefilesforsubdomain
MainDomain has ssl turned on and it's working. I've tried something like this with no success:
RewriteCond %{REQUEST_URI} !^/subdomain.maindomain.com
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} ^maindomain.com
RewriteRule ^(.*)$ /ssubdomain.maindomain.com/$1 [NC,L,NS]
Generic SSL Certificates are issued for one subdomain only. For example: www.example.com, where www is the subdomain.
There are two ways to get SSL on your other subdomain:
Get a new Generic SSL Certificate issued to your new subdomain
Get a Wildcard SSL Certificate, which are issued to a domain rather than a subdomain. For example a Wildcard Certificate is issued to *.example.com
I would recommend Let's Encrypt for free and (mostly) automated certificates.
I have a problem with our site after reinstalling the SSL certificate, where the www version of the site (www.mountainx.com) pulls up a completely different site. if you enter the non-www version (mountainx.com), it goes to the correct website. Some of the rules in my .HTAccess file are here - Any help would be appreciated or at least I would like to get a discussion going -
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
Also I have a certain number of proxy redirects that are not working either after the SSL change and I had to redirect them to the original hosts. To clarify, we use a third party to host our calendar but want to obscure the URL so it looks like we are still hosting the files. When the SSL certificate was installed, it suddenly started throwing up a 503 error so we agreed to change to the original URL hosted remotely. Also any good tutorials on .htaccess file out there? They seem to be pretty few and far between.
We have 2 domanins: miodominio.it (without an SSL certificate) and miodominio.com (with SSL certificate)
Now the domain ".it" should redirect to the domain ".com" so that for every request as:
miodomio.it
www.miodominio.it
https://miodominio.it
https://www.miodominio.it
it's always redirected to https://www.miodominio.COM
Actually if I type in the browser:
www.miodominio.it it correctly redirects me to https://www.miodominio.COM
meanwhile if I type:
miodominio.it (without www) it redirects me to https://miodominio.IT (instead of the .com) but in this case I have a warning message because the domain .IT do not have an SSL certificate, and also it's not redirected to the .com.
How could I solve it so that whatever I have before .miodominio.IT it's always correctly redirected to https://www.miodominio.com ?
Thanks in advance.
You can use in your .htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} miodominio\.it$ [NC]
RewriteRule ^ https://www.miodominio.com%{REQUEST_URI} [NE,L,R=301]
I have looked around and I can't seem to find a definitive solution for this. We are having a small problem with a few or our visitors that are typing in our domain as such:
https://www.example.com - This is giving a security warning "There is a problem with this website's security certificate."
We have an SSL set up for example.com
So if someone types in http://www.example.com or www.example.com this gets redirected to https://example.com which works fine.
This is what I have currently have in my .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,NC,L]
edit:
Most SSL certificates are issued for a specific hostname, e.g. www.example.com or just example.com (and there can be wildcard certificates for *.example.com too) so this might be the case.
Maybe making the www. subdomain an optional match in the last RewriteCond might help to get the user to the domain stated in the certificate:
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.*) [NC]
I think the problem is not with the rewrite/redirect rules but simply with the way http servers handle ssl connection. Before even server has a chance to look into rewrite/redirect rules the SSL handshake take place and if we have a cert for example.com and we enter URL www.example.com connection will abort due to invalid certificate. Check for yourself, set up redirect condition to point URL www.example.com to example.com on SSL secured domain. At first you'll get invalid cert error, but when you add an exception to your browser you'll notice that it works.
Try this
RewriteCond %{HTTP_HOST} ^[a-z0-9-]+\.[a-z]+$
RewriteRule !"" https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NC]
instead of
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,NC,L]
What you are trying to do is impossible. If a user accesses www.domain.cc over SSL, then you will get a certificate error if you do not have a valid SSL certificate - even if all you want to do is redirect them to the correct site.
You will either need a new certificate for www.domain.cc, or convince your registrar to give you a wildcard certificate for *.domain.cc, or one with multiple subjectAltName properties. See http://www.crsr.net/Notes/Apache-HTTPS-virtual-host.html
Or ask for SNA http://en.wikipedia.org/wiki/Server_Name_Indication
Firstly, you will need an SSL certificate that covers both www.xxxx.yyy and xxxx.yyy.
Your provider may cover both if you get the cert for www.xxxx.yyy, but only the xxxx.yyy if you get it for that. Read their conditions carefully.
I had read so many suggestions as to how to redirect, with all manner of ad-hoc opinions, with varying results, and mostly without any formal explanation.
Of course, that means going to the Apache .htaccess reference and working from first principles was in order.
Just to reiterate, the main requirement is to redirect all http(s) requests to https://xxxx.yyy.
As always, turn the rewrite engine on:
RewriteEngine On
For http, that is:
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://xxx.yyy/$1 [L,R]
However, doing the same for https (port = 443), will force a loop, which bombs out with an error. We have to restrict the process to only working for the https and www. We do this by providing two RewriteCond statements in a row, which are treated as an implicit AND:
RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www[.].+$
RewriteRule ^(.*)$ https://xxxx.yyy/$1 [L,R]
At the end of the RewriteRule, the [L,R] tells the rewrite engine to:
L = stop at that rule. That is, if a rule is executed because its conditions (RewriteCond) were satisfied, stop when done, else go to the next conditions/rule set.
R = issue a HTTP redirect (default code = 302) to the browser, so user or automatic action can be taken to update bookmarks, so they always use the https://xxxx.yyy in future.