I config ubuntu server with these command.
sudo a2enmod rewrite
sudo a2ensite 000-default.conf
I edit 000-default.conf like this.
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride all
Require all granted
</Directory>
sudo service apache2 restart
I use let encrypt to create ssl. If I open myweb.com then it redirect to https://myweb.com . But if I open http://myweb.com it show apache page not redirect to https://myweb.com . It look like .htaccess not run.
This is .htaccess code.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
How to fix it?
Redirectdirective (as it is shown here) for this task. – pa4080 Feb 05 '19 at 06:53myweb.comandhttp://myweb.comin the browser is the same thing!? The browser defaults to using thehttpprotocol when omitted. But according to the directives as posted, you should have been ultimately redirected tohttps://www.myweb,com/(2nd redirect) - in both cases - not justhttps://myweb.com. – MrWhite Jul 03 '20 at 22:09