# Redirection problem

**URL:** https://community.letsencrypt.org/t/redirection-problem/37708
**Category:** Help
**Created:** [July 8, 2017, 8:51am UTC](https://community.letsencrypt.org/t/redirection-problem/37708 "2017-07-08T08:51:32Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [July 8, 2017, 8:51am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/1 "2017-07-08T08:51:32Z")

</div>

Hello everyone,

I have a problem on my web server when trying to enable Lets Encrypt for one website.  
First of all I’m running Ubuntu Server 16.04 with Apache 2.4 and the other websites on the server work very well.  
When I try to load a particular website the following message appears:  
The page isn’t redirecting properly

Here’s is my domain.conf in apache

```
<VirtualHost *:80>
            ServerAdmin admin@domain.fr
            ServerName www.domain.fr
            DocumentRoot /home/website/
            <Directory /home/website/>
                    Options Indexes FollowSymLinks MultiViews ExecCGI
                    AllowOverride All
                    Require all granted
            </Directory>
            ErrorLog ${APACHE_LOG_DIR}/domain.fr_error.log
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
            CustomLog ${APACHE_LOG_DIR}/domain.fr_access.log combined
 RewriteEngine on
RewriteCond %{SERVER_NAME} =www.domain.fr
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

```

And here is my domain-le-ssl.conf in apache:

```
<IfModule mod_ssl.c>
    <VirtualHost *:443>
            ServerAdmin admin@domain.fr
            ServerName www.domain.fr
            DocumentRoot /home/website/
            <Directory /home/website/>
                    Options Indexes FollowSymLinks MultiViews ExecCGI
                    AllowOverride All
                    Require all granted
            </Directory>
            ErrorLog ${APACHE_LOG_DIR}/domain.fr_error.log
            # Possible values include: debug, info, notice, warn, error, crit,
            # alert, emerg.
            LogLevel warn
            CustomLog ${APACHE_LOG_DIR}/domain.fr_access.log combined
    SSLCertificateFile /etc/letsencrypt/live/www.domain.fr/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.domain.fr/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost>
    </IfModule>

```

Does anyone see something wrong in this configuration ?  
I have nothing in apache error log except  
`[Sat Jul 08 08:10:04.938672 2017] [ssl:warn] [pid 16376] AH01909: domain.fr:443:0 server certificate does NOT include an ID which matches the server name`

---

<div class="post-metadata">

### Author: ![jmorahan](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jmorahan/32/1873_2.png) [@jmorahan](https://community.letsencrypt.org/u/jmorahan)
#### Post date: [July 8, 2017, 11:18am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/2 "2017-07-08T11:18:37Z")

</div>

I don’t see anything wrong in those files. However, I notice you have `AllowOverride All` in both. Do you have a `.htaccess` file in `/home/website`? If so, the problem may be there instead.

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [July 8, 2017, 11:37am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/3 "2017-07-08T11:37:07Z")

</div>

Good idea but I haven’t any .htaccess file in my root directory…

---

<div class="post-metadata">

### Author: ![jmorahan](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jmorahan/32/1873_2.png) [@jmorahan](https://community.letsencrypt.org/u/jmorahan)
#### Post date: [July 8, 2017, 11:55am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/4 "2017-07-08T11:55:18Z")

</div>

Hmm.

Are you using a reverse proxy or CDN with this domain? If so, it might be connecting to your webserver over HTTP, which would cause the :80 configuration to kick in again.

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [July 8, 2017, 2:54pm UTC](https://community.letsencrypt.org/t/redirection-problem/37708/5 "2017-07-08T14:54:24Z")

</div>

No Cloudflare or CDN either

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 3, 2017, 6:51am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/6 "2017-08-03T06:51:15Z")

</div>

I still have the problem, does anyone have ideas ?

---

<div class="post-metadata">

### Author: ![ahaw021](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/ahaw021/32/14882_2.png) [@ahaw021](https://community.letsencrypt.org/u/ahaw021)
#### Post date: [August 3, 2017, 8:27am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/7 "2017-08-03T08:27:47Z")

</div>

maybe share your domain name so people can investigate it?

Andrei

---

<div class="post-metadata">

### Author: ![jared.m](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jared.m/32/17871_2.png) [@jared.m](https://community.letsencrypt.org/u/jared.m)
#### Post date: [August 3, 2017, 9:01am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/8 "2017-08-03T09:01:11Z")

</div>

I’m more of an nginx guy, so I’m just going by what’s familiar, but are you sure those redirect rules are set up properly? I seem to recall seeing that typically written differently.

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 3, 2017, 9:54am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/9 "2017-08-03T09:54:57Z")

</div>

I have two more domains on the same server that use the exacts same rules and they work perfectly.

---

<div class="post-metadata">

### Author: ![ebonsi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/ebonsi/32/14423_2.png) [@ebonsi](https://community.letsencrypt.org/u/ebonsi)
#### Post date: [August 4, 2017, 3:13am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/10 "2017-08-04T03:13:03Z")

</div>

Here is my configuration so you can compare…

```
# domain.org site
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]
DocumentRoot "/Users/domain2/Sites"
ServerName domain.org
ServerAlias www.domain.org
ServerAdmin webmaster@domain.org
</VirtualHost>

# domain.org site virtual host SSL 443
<VirtualHost *:443>
DocumentRoot "/Users/domain2/Sites"
ServerName domain.org
ServerAlias www.domain.org
ServerAdmin webmaster@domain.org
SSLProtocol all -SSLv2 -SSLv3
SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/domain.org/cert.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/domain.org/privkey.pem"
    SSLCertificateChainFile "/etc/letsencrypt/live/domain.org/chain.pem"

    # HSTS (mod_headers is required) (15768000 seconds = 6 months)
    Header always set Strict-Transport-Security "max-age=15768000"
    # Always ensure Cookies have "Secure" set (JAH 2012/1)
    Header edit Set-Cookie (?i)^(.*)(;\s*secure)??((\s*;)?(.*)) "$1; Secure$3$4"

    ErrorLog "/usr/apache2/logs/error_log"
    TransferLog "/usr/apache2/logs/access_log"
    CustomLog /usr/apache2/logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

```

You have this line which I think is not necessary putting “=[www.domain.fr](http://www.domain.fr)” ;  
`RewriteCond %{SERVER_NAME} =www.domain.fr`  
Try to do this instead;

`RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]`

---

<div class="post-metadata">

### Author: ![ahaw021](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/ahaw021/32/14882_2.png) [@ahaw021](https://community.letsencrypt.org/u/ahaw021)
#### Post date: [August 4, 2017, 3:51am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/11 "2017-08-04T03:51:20Z")

</div>

hi @Notarobot

I think you missed my previous comment so I will try again.

A) You have made an assumption that Apache is the only thing that can do redirects.  
B) You have not provided a domain name so people can’t do their own testing  
C) You therefore should do your own testing. Use chrome developer tools or something like this [http://www.redirect-checker.org/index.php](http://www.redirect-checker.org/index.php)

If you would like people to provide assistance then you should do your bit (share information) otherwise google and stackexchange are your friends if you can’t share your domain

Andrei

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 4, 2017, 5:15am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/12 "2017-08-04T05:15:10Z")

</div>

> [@ebonsi](#):
>
> RewriteRule ^/(.\*) https://%{SERVER\_NAME}/$1 [R,L]

Still the same problem using your redirection rules..

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 4, 2017, 5:19am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/13 "2017-08-04T05:19:30Z")

</div>

Hi,

A) Can you explain to me what I’m missing ?  
B) [www.duboisveysseyre.fr](http://www.duboisveysseyre.fr)  
C) [Rediret-cheker.org](http://Rediret-cheker.org) output:  
`https://www.duboisveysseyre.fr 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found https://www.duboisveysseyre.fr/index.php 301 Moved Permanently http://www.duboisveysseyre.fr/index.php? 302 Found Problems found:`

```
    Too many redirects. Please try to reduce your number of redirects for https://www.duboisveysseyre.fr. Actually you use 19 Redirects. Ideally you should not use more than 3 Redirects in a redirect chain. More than 3 redirections will produce unnecessary load on your server and reduces speed, which ends up in bad user experience.
    You use 301 and 302 redirect at the same time. This might be confusing for search engine. Generally, please do not use 301 and 302 redirects at the same time.
    You use a 302 redirect. This means, that the actually content is temporary not reachable and will come back soon. To use a 302 redirection for generally moved pages is a bad idea. Search engine bot might not follow it or handle it as temporary. For SEO this is also a bad idea, because no link juice will be transferred to the linked page.`
```

---

<div class="post-metadata">

### Author: ![ebonsi](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/ebonsi/32/14423_2.png) [@ebonsi](https://community.letsencrypt.org/u/ebonsi)
#### Post date: [August 4, 2017, 5:48am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/14 "2017-08-04T05:48:36Z")

</div>

> [@Notarobot](#):
>
> Ubuntu Server

Interesting, you are on the Ubuntu Server. On my server both of these directives goes on the virtual host file and not inside the if module configuration.

`<IfModule mod_ssl.c>`  
...  
`</IfModule>`

The `</IfModule>` is usually to redirect the includes pointing to the virtual host file.

Do you have an virtual host file? Something with the name  
`httpd-vhosts.conf` ?

We are at different operating system but Apache directory tree is (I think) standard to everyone.

![apache-directory-tree-001](https://sea3.discourse-cdn.com/letsencrypt/uploads/default/original/2X/0/0ab34494a0dab89453a08d71a70a2ae1d59d50a4.png)

You should put your Apache Configuration Directory tree here because something is not adding up.

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 4, 2017, 6:53am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/15 "2017-08-04T06:53:39Z")

</div>

All of my vhosts files are in /etc/apache/sites-available/  
I have a mydomain.conf that correspond to the http vhost containing redirection rules to the https domain  
Certbot creates a mydomain-le.conf that correspond to the https vhost  
All the sites on this server have the same configuration and structures and work fine.

---

<div class="post-metadata">

### Author: ![jmorahan](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jmorahan/32/1873_2.png) [@jmorahan](https://community.letsencrypt.org/u/jmorahan)
#### Post date: [August 4, 2017, 12:10pm UTC](https://community.letsencrypt.org/t/redirection-problem/37708/16 "2017-08-04T12:10:03Z")

</div>

Your HTTP site is redirecting to HTTPS. Your HTTPS site is then redirecting back to HTTP and adding `index.php?` to the end of the URL. I don’t see anything in `domain-le-ssl.conf` that looks like it would do that, so I’m guessing the problem is elsewhere.

Are you _sure_ you don’t have a .htaccess file? (you know it’s hidden by default, right? type `ls -a` to see it)

If that’s not it, it might be something in the PHP code itself that’s doing the redirect. Is it your own custom code or something you downloaded? **EDIT** : based on your favicon I’m guessing you’re using webtrees - if so then [this information](https://wiki.webtrees.net/en/Security#Hypertext_Transfer_Protocol_Secure_.28HTTPS.29) may be helpful.

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 5, 2017, 7:48am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/17 "2017-08-05T07:48:19Z")

</div>

Well, I didnt thought about that ! Thanks for the link I’ll check that before anything else.

---

<div class="post-metadata">

### Author: ![Notarobot](https://avatars.discourse-cdn.com/v4/letter/n/f19dbf/32.png) [@Notarobot](https://community.letsencrypt.org/u/Notarobot)
#### Post date: [August 5, 2017, 7:57am UTC](https://community.letsencrypt.org/t/redirection-problem/37708/18 "2017-08-05T07:57:07Z")

</div>

Ok That was it ! I just needed to change the website URL in webtrees DB so it can use HTTPS !  
It definitely had nothing to do with Let’s Encrypt.

Thank you so much for your help @jmorahan

---

<div class="post-metadata">

### Author: ![ahaw021](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/ahaw021/32/14882_2.png) [@ahaw021](https://community.letsencrypt.org/u/ahaw021)
#### Post date: [August 5, 2017, 12:53pm UTC](https://community.letsencrypt.org/t/redirection-problem/37708/19 "2017-08-05T12:53:15Z")

</div>

well done @jmorahan

@Notarobot that was what i was talking about in my post above when i said this

> you have made an assumption that Apache is the only thing that can do redirects.

Javascript and Server Side Languages can also redirect hence why a domain is useful as it allows people to discover other sources.

Andrei

---

<div class="post-metadata">

### Author: ![system](https://global.discourse-cdn.com/letsencrypt/original/3X/c/a/ca6c06ea1ea201324bba7048c6841ce60236468d.png) [@system](https://community.letsencrypt.org/u/system)
#### Post date: [September 4, 2017, 12:53pm UTC](https://community.letsencrypt.org/t/redirection-problem/37708/20 "2017-09-04T12:53:23Z")

</div>

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