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

  • | 717 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,

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

  • | 94 points

    The HTTP 301 Moved Permanently redirect status response code indicates that the resource requested has been definitively moved to the URL given by the Location headers. A browser redirects to this page, and search engines update their links to the resource (In SEO-speak, it is said that the link-juice is sent to the new URL).

Log in to reply

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