ssl - Apache 2.4 url rewriting with https -


i'm trying url rewriting apache 2.4. want requests to

  1. http://subdomain.domain.com
  2. http://www.subdomain.domain.com
  3. https://www.subdomain.domain.com

are remapped

https://subdomain.domain.com

to avoid error in ssl wildcard cert doesn't not match www.subdomain.domain.com.

i tried with:

    <virtualhost ip:80>         servername subdomain.domain.com         rewriteengine on         rewritecond %{https} off         rewriterule (.*) https://%{http_host}%{request_uri}           </virtualhost>    <virtualhost ip:80>         servername www.subdomain.domain.com         redirect permanent / https://subdomain.domain.com    </virtualhost>    <virtualhost ip:443>         servername www.subdomain.domain.com         redirect permanent / https://subdomain.domain.com    </virtualhost>   <virtualhost ip:443>         servername subdomain.domain.com         ...         ...         ... 

my configuration works (1) , (2) not (3). mistake?

i think problem 1 of port 443 virtualhosts not have ssl on.

try this

<virtualhost ip:443>     servername www.subdomain.domain.com     redirect permanent / https://subdomain.domain.com     sslengine on     sslcertificatefile    /something     sslcertificatekeyfile /something </virtualhost> 

otherwise, request won't understood, because it's encrypted.

see eg how redirect https http without ssl certificate why necessary.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -