Report this

What is the reason for this report?

http > https redirect

Posted on June 9, 2020

Hello, I set up a new droplet with the wordpress default, I also enabled ssl with the certbot, i asked for the cert bot to configure a forward of http to https, but it didn’t work for me. I’ve tried adding the permanent redirect line in the config file, but it doesn’t seem to have taken it up? Location: /etc/apache2/sites-enabled/000-default.conf here’s my config:

UseCanonicalName On

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        ServerName 40acresproject.com
        ServerAlias www.40acresproject.com
        Redirect permanent / https://40acresproject.com/

        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =40acresproject.com [OR]
RewriteCond %{SERVER_NAME} =www.40acresproject.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Thanks in advance for your help!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @garfield1979 ,

Open

Apache/conf/httpd.conf

find

#LoadModule rewrite_module modules/mod_rewrite.so

and delete #

Overwrite .htaccess with

RewriteEngine on          
RewriteBase /             
RewriteCond %{SERVER_PORT} !^443$    
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]    

Then restart Apache service.

Kind regards, Shiroka

Thanks for the help.

So I’ve looked for httpd.conf file, I cannot find it. the only conf file referenced in apache is 000-default.conf (which contents i posted above) there also is no .htaccess file present anywhere in the website.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.