Skip to content

The Dummy Programmer

Stories of daily programming

  • Home
  • The Dummy Programmer Robot
    • Overview
    • Version history & downloads
    • Tutorials
      • TDP Robot – The basics
      • A simple SQL Server backup solution
      • A simple SQL Server backup solution – A next step
  • My other dummy projects
  • Games
    • Space Y: An Asteroids clone
  • Services
    • What’s my user agent
    • What’s my IP address
  • About
  • Toggle search form

Redirect to HTTPS using Apache .htaccess file

Posted on September 26, 2018September 26, 2018 By

I created a Joomla website and published online in the customer hosting space of the provider Aruba. Aruba, in his hosting plans, provides a free domain validated certificate and so I wanted to use it. I installed the certificate and then I tried to make an automatic redirect in order to use the HTTPS protocol.

Around the web I found several articles on how to do it using the Apache .htaccess file, but none of them worked correctly for me. I often got the message “Bad request – too many redirects”.

I finally found the solution in an offical Aruba guide, that you can find at this address:

https://guide.hosting.aruba.it/servizi-aggiuntivi/certificato-ssl/ssl-per-servizi-hosting/ridirigere-traffico-da-http-a-https.aspx

Basically, to redirect all the traffic to HTTPS you have to configure your .htaccess file with these directives:

RewriteEngine On

RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Using the directives above, the site now correctly redirect to HTTPS.

Bye bye 🙂

 

 

Apache

Post navigation

Previous Post: Fatal error using FuelPHP and Imagick extension
Next Post: Self signed certificate with Apache/Ubuntu

Related Posts

Run an Apache website under SSL Apache
Self signed certificate with Apache/Ubuntu Apache
Add a new website to an Apache installation Apache

Search

Related posts

  • Zipping xlsx file correctly
  • Searching files and file content in Windows
  • Sql Server Instant File Initialization
  • Splitting a big file in multiple small files

Categories

  • .NET 6 (1)
  • AJAX (1)
  • Android (2)
  • Apache (4)
  • ASP.NET (9)
  • ASP.NET MVC (3)
  • Avalonia UI (1)
  • BCP (1)
  • Bitlocker (2)
  • C# (14)
  • CentOS (4)
  • ClosedXML (1)
  • CLR (1)
  • DNS (1)
  • Encryption (3)
  • Excel (2)
  • FuelPHP (3)
  • Games (2)
  • Google Chrome (1)
  • GSuite (1)
  • HTML (1)
  • Imagick (2)
  • Javascript (1)
  • Kindle (1)
  • LAMP (3)
  • Linux (6)
  • MariaDB (2)
  • Mathematics (2)
  • MySql (4)
  • NPOI (1)
  • Office 365 (1)
  • Perl (1)
  • PHP (6)
  • Programming (1)
  • Remote desktop (1)
  • SFTP (2)
  • Sockets (3)
  • Sql Server (18)
  • Sql Server 2016 (14)
  • Sql Server 2019 (1)
  • SSL (2)
  • Task scheduler (1)
  • Telerik ASP.NET AJAX (2)
  • The Dummy Programmer Chat (2)
  • The Dummy Programmer Robot (6)
  • Threading (5)
  • Tools (1)
  • TPL (3)
  • TypeScript (3)
  • Ubuntu (4)
  • Virtualization software (3)
  • Visual Studio (1)
  • Visual Studio Code (2)
  • Web fonts (1)
  • Web programming (6)
  • Windows (12)
  • Windows 10 (15)
  • Windows Forms (1)
  • Windows Server (6)

Copyright © 2023 The Dummy Programmer | Privacy Policy | Terms of use |

Powered by PressBook Masonry Dark