You know when you type in digitalocean.com it automatically redirects to https://www.digitalocean.com? I want that for my site! I spent a lot of time generating (and regenerating secure certs…thanks openSSL!) and I would love to force https. The only thing is I am having redirect loops and am not sure what I am doing wrong :/
Here’s my httpd.conf: Redirect permanent / https://www.<MYDOMAINNAME>.com:443
and here’s my .htaccess: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
So right now if I type in rhosfelt.com it does the automatic redirection to https, but how do I get it to do this for every subsite (/blog, /test.html etc)?
If I try to go to any other page I am getting a “This page has too many redirects” error… Your help will be appreciated! Thanks!!!
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!
This one works for m. In my .htaccess:
RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Of course, this is assuming your .htaccess is working
Yes, to get .htaccess to work you must:
set AllowOverride All in your website conf file (in /etc/apache2/sites-available/yoursite.conf) like this:
<Directory /var/www/yourwebsite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
Enable mod_rewrite: sudo a2enmod rewrite
Reload apache: sudo service apache2 reload
Then your .htaccess file should work.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.