Tony92
Tony92

Reputation: 91

Using apache Url Rewrite from HTTPS to another HTTPS

I have an apache server on Centos 7. I also have a miltidomain certificate. I would like to redirect https://old-domain.com to https://new-domain.com. Redirecting from http to https works but not redirecting from https to https. I am trying to replace in all cases old-domain.com by new-domain.com in http or https. I do not know what's wrong.

Thank you in advance, Tony92

Here is my configuration file /etc/httpd/conf.d/mydom.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "/var/www/html"
    ServerName myserver.new-domain.com 
    ServerAlias myserver
    RewriteEngine On
    RewriteCond   %{SERVER_PORT}  !^443$
    RewriteRule ^/(.*)$ https://new-domain.com/$1 [L,R]
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot "/var/www/html"
    ServerName myserver.new-domain.com 
    RewriteEngine on
    RewriteCond %{HTTPS} on
    RewriteRule ^/(.*)$ https://new-domain.com/$1 [L,R]
    SSLEngine on
    # SSLProxyEngine On
    SSLCertificateFile /etc/pki/tls/certs/myserver.crt
    SSLCertificateKeyFile /etc/pki/tls/private/myserver.key
    SSLCertificateChainFile /etc/pki/tls/certs/DigiCertCA.crt
    SSLProtocol all -SSLv2
    SSLHonorCipherOrder on
    SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA
    <Files ~ "\.(cgi|shtml|phtml|php3?)$">
       SSLOptions +StdEnvVars
    </Files>
    <Directory "/var/www/cgi-bin">
      SSLOptions +StdEnvVars
    </Directory>
</VirtualHost>

Upvotes: 0

Views: 594

Answers (1)

Eug&#232;ne Adell
Eug&#232;ne Adell

Reputation: 3174

I suggest you to try this (it would be better to have an FQDN instead of an IP address) :

                ProxyPreserveHost Off
                ProxyPass /api http://x.x.x.x:5601/api
                ProxyPassReverse /api http://x.x.x.x:5601/api

Upvotes: 1

Related Questions