4
votes

I have a simple wordpress install using Mamp Free Version on OS/X.

Version 2.0.19/2.0.19
Web Interface h#tp#//127.0.0.1:4040
Forwarding h#tp#//6c219c8e.ngrok.io -> localhost:8888 Forwarding
h#tps#//6c219c8e.ngrok.io -> localhost:8888
Connections ttl opn rt1 rt5 p50
p90
1 0 0.00 0.00 6.00 6.00

For some reason when I try the links generated by ngrok, the website loads forever, then I get

Page not available.

7
make sure you website is running at localhost:8888 and firewall is not blocking that port.atinder
I checked, I don't have a firewall running on my laptop, and I checked the port to confirm it was 8888 in MAMP.Stacy

7 Answers

8
votes

As @Magico stated, download from the repo https://github.com/jonathanbardo/WP-Ngrok-Local and place that in your plugins directory, activate the plugin.

Then, after you get your ngrok tunnel URL up & running, take that URL and place it in your wp-config.php as follows:

define( 'WP_SITEURL', 'http://example.ngrok.io/' );
define( 'WP_HOME', 'http://example.ngrok.io/' );

Now you will be able to access the homepage as well as the admin dashboard.

5
votes

According to the faq:

You need to add one of the following plugins to force Wordpress to issue relative URLs.

Sorry I don't have enough reputation points to post the rest of links.

4
votes

You can start ngrock setting your virtual host and your port with this command:

ngrok http -host-header=dev.yoursite 8080

and then install and activate only one of these plugin to navigate with relative urls

https://github.com/jonathanbardo/WP-Ngrok-Local (i'm using this one)

https://github.com/optimizamx/odt-relative-urls

http://wordpress.org/plugins/relative-url/

http://wordpress.org/plugins/root-relative-urls/

full article and documentation here https://ngrok.com/faq#virtual-hosts

1
votes

I'm not having luck with this approach. I'm using a plugin called "Relative URL" but only the homepage is rendering on my end. Other pages in the site do not show up. The site is running locally as localhost:8888 which is the path I set temporarily in the SETTINGS>GENERAL SETTINGS and I noticed with the Relative URL plugin running it's still trying to throw the :8888 on the end of the ngrok URL. Just don't know what to do about it currently.

1
votes

The Relative URL plugin in wordpress got my site loading correctly remotely through ngrok.

0
votes

For someone who is still having an issue with ngrok on wordpress , you can follow these steps:

  1. After running ngrok copy the link and edit siteurl and home column in wp_options table

  2. Go on administration panel and then edit your menus by adding ngrok_url generated.

0
votes

I have a much better solution. Much much better. Download the program called "sitesucker" in order to download all files of your site from the localhost. You need to put the address https://localhost/websitename or https://localhost/wordpress, inside the SiteSucker app, if you are like me :), then you put the folder of the website you have downloaded just now, inside your localhost. This is kinda of an assembled site, because sitesucker makes requests for all pages and downloads css and htmls, and also all resources. Sitesucker, if used correctly, and legally, is a great tool. Everyone that will access to this folder after you share the link with ngrok, will see it as a normal website, assembled, not as wordpress format... if you understand what I mean. So you share the link that brings straight to your localhost, I mean the link that ngrok have created, and people can see the website from the folder that has your assembled website, downloaded previously from SiteSucker :) DONE