Redirect after SSL install

Hello

After installing the SSL Cert, I now have a redirect problem. Here is the line that I think is giving me problems.

ServerName www.nextstudy.org
ServerAlias nextstudy.org
Redirect / https://nextstudy.org/

Questions

  1. Is that line causing the Err_Too_Many_Redirects that I get?
  2. What should it say?
  3. How do I change it?

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. https://crt.sh/?q=example.com), so withholding your domain name here does not increase secrecy, but only makes it harder for us to provide help.

My domain is: www.nextstudy.org

I ran this command: Installed Let’s Encrypt SSL Cert

It produced this output: Successful SSL, but ERR_TOO_MANY_REDIRECTS

My web server is (include version): Debian Jessie

The operating system my web server runs on is (include version): Google Cloud

My hosting provider, if applicable, is: Google Cloud

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

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

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

Hi @dougRSA

where is that defined? In your port 443 vHost? That’s wrong. That must be in your port 80 vHost.

And your certificate is wrong ( https://check-your-website.server-daten.de/?q=nextstudy.org ):

Domainname Http-Status redirect Sec. G
http://nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 0.236 A
http://www.nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 0.236 E
https://nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 1.163 L
https://www.nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 1.173 N
Certificate error: RemoteCertificateNameMismatch

Your certificate

CN=nextstudy.org
	18.06.2019
	16.09.2019
expires in 89 days	nextstudy.org - 1 entry

has only one domain name. Create one certificate with both domain names (non-www and www) and use that.

Oh - you have already created such a certificate:

CertSpotter-Id Issuer not before not after Domain names LE-Duplicate next LE
972452390 CN=Let’s Encrypt Authority X3, O=Let’s Encrypt, C=US 2019-06-18 00:12:19 2019-09-16 00:12:19 nextstudy.org - 1 entries duplicate nr. 1
972390976 CN=Let’s Encrypt Authority X3, O=Let’s Encrypt, C=US 2019-06-17 23:26:25 2019-09-15 23:26:25 nextstudy.org, www.nextstudy.org - 2 entries duplicate nr. 1

So try

certbot -d nextstudy.org -d www.nextstudy.org -reinstall

then Certbot should find the certificate and should try to install it.

Here is the result.

Did I enter it incorrect?

doug@wordpress-nextstudy-vm:~$ certbot -d nextstudy.org -d www.nextstudy.org -reinstall
-bash: certbot: command not found

Use your certbot version: Certbot, certbot-auto, letsencrypt, letsencrypt-auto. All is possible, it’s your installation.

Tried these 4. But I fear I am missing something obvious. Here are the results

doug@wordpress-nextstudy-vm:~ certbot -d nextstudy.org -d www.nextstudy.org -reinstall -bash: certbot: command not found doug@wordpress-nextstudy-vm:~ certbot-auto -d nextstudy.org -d www.nextstudy.org -reinstall
-bash: certbot-auto: command not found
doug@wordpress-nextstudy-vm:~ letsencrypt -d nextstudy.org -d www.nextstudy.org -reinstall -bash: letsencrypt: command not found doug@wordpress-nextstudy-vm:~ letsencrypt-auto -d nextstudy.org -d www.nextstudy.org -reinstall
-bash: letsencrypt-auto: command not found

Which command did you use?

I tried all 4

certbot -d nextstudy.org -d www.nextstudy.org -reinstall

certbot-auto --d nextstudy.org -d www.nextstudy.org -reinstall

letsencrypt -d nextstudy.org -d www.nextstudy.org -reinstall

letsencrypt-auto -d nextstudy.org -d www.nextstudy.org -reinstall

Is there another command I should do first or do a different directory?

How did you create your certificate? Do that again.

Maybe add ./ --> ./certbot-auto etc.

ok

When it comes the question about how to redirect the website it offers option 1 and 2, which I believe are redirect http to https or something like that. Which option should I do?

What file would I open with the nano command to stop the redirect?

Apache has a basic configuration, something like

/etc/apache2/
|-- apache2.conf
|       `--  ports.conf
|-- mods-enabled
|       |-- *.load
|       `-- *.conf
|-- conf-enabled
|       `-- *.conf
|-- sites-enabled
|       `-- *.conf

directories may differ.

So sites-enabled or the main config should have the wrong redirect.

Thanks. I looked in /etc/apache2/apache2.conf. There is code but no redirect command. I didn’t find code using nano is any other of the file names. See below.

Any idea for another directory to look into?

doug@wordpress-nextstudy-vm:~ nano /etc/apache2/conf-enabled doug@wordpress-nextstudy-vm:~ nano /etc/apache2/apache2.conf
doug@wordpress-nextstudy-vm:~ nano /etc/apache2/sites-enabled.conf doug@wordpress-nextstudy-vm:~ nano /etc/apache2/conf-enabled.conf
doug@wordpress-nextstudy-vm:~ nano /etc/apache2/mods-enabled.conf doug@wordpress-nextstudy-vm:~ nanao /etc/apache2/apache2.conf
-bash: nanao: command not found
doug@wordpress-nextstudy-vm:~$ nano /etc/apache2/apache2.conf

First you should check your domain - see https://check-your-website.server-daten.de/?q=nextstudy.org

Domainname Http-Status redirect Sec. G
http://nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 0.240 A
http://www.nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 0.240 E
https://nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 1.190 L
https://www.nextstudy.org/
104.198.17.59 302 https://nextstudy.org/ 1.170 N
Certificate error: RemoteCertificateNameMismatch

All is redirected to https://nextstudy.org/.

Maybe one redirect rule, maybe more then one with the same effect. May be a wrong .htaccess or an application redirect.

PS:

There

is already the answer.

Redirect “/” “https://www.blabla.com/
BR