Bug/feature request submission? Laragon/ngrok/WordPress error 301 Moved Permanently


  • | 289 points

    I'm using Laragon for local WordPress development and I really like it a lot!

    I was now testing with making my local WordPress sites I create on Laragon available to external devices via ngrok.

    Enabling it is a breeze but I had to pull a trick to get it to work... I always received a "301 Moved Permantly" error when accessing the site from outside my computer (even within the same network) and noticed that when entering my ngrok link, it reverted it to mysite.dev which of course can't be found on other devices.

    After some searches on the internet I've found a solution to the problem and that was to add these lines to the wp-config file of the local site in question :
    /** Fix for NGROK 301 Moved permanently **/
    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);

    I'm not sure if this can be implemented in Laragon itself via an update that this will be added when enabling sharing and removed when disabling share via ngrok.

    Just figured I'd open a topic about this here on the forums...

    Best regards,
    Hans

    ps : if this is not the proper way to report such stuff, apologies already ;)


Log in to reply
 

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