Https:// redirect to other domain on same server after issuing and setting up SSL

Please fill out the fields below so we can help you better. Note: you must provide your domain name to get help. Domain names for issued certificates are all made public in Certificate Transparency logs (e.g., so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

I am having files
cert.pem chain.pem fullchain.pem privkey.pem
which i gets from command
sudo certbot-auto certonly --standalone -d -d
with a success message, but the domain name with https:// redirecting to which is the another domain on same server.
I am a newbie in this, i setup SSL couple of times ago on other domains too, but this time i am having this issue.
i am having file in /etc/apache2/site-enabled diretory with following contents

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined

<VirtualHost *:443>
DocumentRoot /var/www/html
ErrorLog {APACHE_LOG_DIR}/error.log CustomLog {APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/
SSLCertificateKeyFile /etc/letsencrypt/live/
SSLCertificateChainFile /etc/letsencrypt/live/

Please tell me what is am missing is i am having issue with SSL or Apache itself? let me know if any other details are needed.

Thanks in advance.
My domain is:

I ran this command:

It produced this output:

My web server is (include version): Apache/2.4.38 (Ubuntu)

The operating system my web server runs on is (include version): Ubuntu 19.04 (GNU/Linux 5.0.0-27-generic x86_64)

My hosting provider, if applicable, is:

I can login to a root shell on my machine (yes or no, or I don’t know): Yes, (SSH access)

I’m using a control panel to manage my site (no, or provide the name and version of the control panel): No

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you’re using Certbot):
certbot --version => certbot 0.31.0
certbot-auto --version => certbot 1.3.0

1 Like

HTTP connections are not redirected:

curl -Iki
HTTP/1.1 200 OK
Date: Sat, 02 May 2020 04:43:23 GMT
Server: Apache/2.4.38 (Ubuntu)
Content-Type: text/html;charset=UTF-8

HTTPS connections do get redirected.
But that seems that is may be an incorrect setting in WORDPRESS.
[it could be in Apache - but I doubt you went in there to change anything manually]

curl -Iki
HTTP/1.1 301 Moved Permanently
Date: Sat, 02 May 2020 04:43:30 GMT
Server: Apache/2.4.38 (Ubuntu)
X-Redirect-By: WordPress
Content-Type: text/html; charset=UTF-8
1 Like

Thanks for you kind reply
i also noticed that too so what i do yesterday is, i actually rename the folder which serve on server. and create a fresh directory using ‘mkdir’ command, but still x redirect by WordPress is appearing on headers, i am confused, if folder is fresh how can it be x-redirect-by WordPress?

you can check by clicking (without https), it is an empty folder.

Please help

1 Like

Sorry I don’t know much about WordPress.
I might be able to help you with Apache.
But changing the Apache config outside of WordPress may get overwritten with any future WordPress modifications.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.