DEV Community

Cover image for How To Deal With SEO While Developing Locally
Antonello Zanini for Writech

Posted on • Originally published at writech.run

How To Deal With SEO While Developing Locally

I recently worked on a project I could not deliver online until completing it. Due to business agreements, I could not make the website I was working on public before a certain date. The main problem was that my client's most important concern was SEO. They wanted an extremely competitive website in terms of SEO ranking.

There are plenty of SEO audit tools online, but they all require that your website be publicly accessible through the Internet. In other words, they require your website to be online and currently accessible by their software. This may represent a problem, especially if you want to improve the SEO performance of your website but you must work on it locally. Luckily, there is a solution!

So, let's learn how to let online SEO audit tools access your website hosted locally on localhost.

Exposing a localhost Website with Ngrok

Since the problem is that your website hosted locally is not publicly accessible, the solution is to temporarily expose it to the Internet while running it on localhost. This might appear challenging to achieve, but it is not thanks to ngrok.

ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels — ngrok - How it works

All you have to do is follow these steps:

  1. Host your website locally with a local web server and make sure it is available under the localhost domain

  2. Download ngrok here and unzip it

  3. Enter the folder you unzipped ngrok in run it by launching the following command:

./ngrok http 80
Enter fullscreen mode Exit fullscreen mode

Note that the last number must correspond to the port used by your web server running on localhost — usually 80, 8080, or 3000. In detail, by launching that command an HTTP tunnel on port 80 will be started.

The result of the  raw `ngrok http 3000` endraw  command

This is what your console will look like after running that command. In my case, I launched the ngrok http 3000 command and ngrok is telling me that everyone can now access my website running on localhost:3000 by reaching the http://0fd3-91-187-193-31.ngrok.io URL.

In other words, your website hosted locally is now publicly accessible and you can pass that link to your favorite SEO audit tool. This is also a good way to make sitemap validator online tools inspect your website hosted on localhost.

Keep in mind that HTTP tunnels are slow, and the SEO audit tool you selected may warn you about performance issues, especially when it comes to latency time. This is something related to how you are exposing your local website to the Internet and you can basically ignore those warnings.

Conclusion

Here we learned how to expose a website hosted on localhost to the Internet to make it accessible by the many online SEO audit tools. In fact, most of these tools require your website to be publicly accessible on the Internet, and this is a problem when you cannot make your website public and you must work on it locally. Thankfully, ngrok is a powerful tool that allows you to temporarily expose a local website to the Internet with no effort, and explaining how to use it what was this article was about.


The post "How To Deal With SEO While Developing Locally" appeared first on Writech.

Top comments (0)