How Do You Start a Laragon Website as https://?

  • | 286 points

    I have SSl enabled in Apache and added the laragon.crt to the trust store. When I open www > sitename.test, I would like to have it open as https://sitename.test. I edited the auto.sitename.test.conf file to add https:// to the define SITE statement, but this didn't open the site in https://. I can manually type https://sitename.test in the browser address bar and that does work. What do I need to do to automate this?

  • | 17 points

    I want to ask same question too. Waiting an answer from another person.

  • | 16270 points

    @nitrobob according to SO - How to automatically redirect HTTP to HTTPS on Apache servers? the recommended way is via .conf files. We cant use this method as Laragon will overwrite these .conf files automatically. Further down is the alternative way with .htaccess, I created the following as a demo, which works with the index.php on localhost. Create the .htaccess file and save it in C:\laragon\www. Then open http://localhost.

    <IfModule mod_rewrite.c>
        SetEnv HTTP_MOD_REWRITE On
        RewriteEngine On
        RewriteCond %{HTTPS} !=on
        # This checks to make sure the connection is not already HTTPS
        RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
        # This rule will redirect users from their original location, to the same location but using HTTPS.
        # i.e. to
        # The leading slash is made optional so that this will work either in
        # httpd.conf or .htaccess context
        # add other rules as required.....

    If you open developer tools you will see the page is redirected


    You will also see the padlock.


    Feel free to modify the file for your project. Put the file in the entry point of your project (either the root or the public folder) and all HTTP requests will be re-routed to HTTPS. If your project already has a file then add the above rule before the other rules.

    I hope this helps.

Log in to reply

Looks like your connection to Laragon was lost, please wait while we try to reconnect.