Redirect HTTP to HTTPS with .htaccess file


#1

I have Let's Encrypt SSL certificate for exampledomain.com. www.exampledomain.com redirects to https://exampledomain.com, but exampledomain.com gives “Apache2 Ubuntu Default Page”. I tried to redirect it with following code in .htaccess file. First section was added by WordPress installer automatically.

.htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.exampledomain.com/$1 [R,L]

#2

Problem here is that the vHost configuration for http://exampledoamin.com probably doesn’t point to the WordPress installation.


#4

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