How to test localhost website with Google SEO tools

How to test localhost website with Google SEO tools

Recently i had to accompany a customer on implementing Structured data markup (Schema.org) on a big website during the development of its new version. After SEO audit, i kicked off implementation stage with the Agile technical team. One of the main constraints of the development process was : We shouldn’t make the website public ! And in the other hand, i required using SDTT (Google Structured Data Testing Tool) to validate JSON-LD code before deploy on production. So how should we deal with it ?

I will explain you in this post the solution that i gave to be able to test localhost websites with the official Google tools and not only SDTT but also Speed Insight, AMP validation tool, Mobile friendly tool..etc.

Requirements :

  • A local web server : such as WampServer, XAMPP…etc to run locally your website.
  • Ngrok : a very handy tool that allows to expose localhost or behind firewall applications to the “internet”, in our case to Google tools.
  • A website to test 🙂
  1. Install Ngrok
    You can download Ngrok from the official website : https://ngrok.com/  (Mac, Windows, Linux)
  2. Run your localhost on the port you want (usually 80 or 8080)
  3. Run Ngrok and precise the chosen port on step 2 byt typing : ngrok http 80 for example and we will get this answer

ngrok start

So here we see that the Session is online and that means that our localhost is exposed via the given address (subdomain of ngrok.io). In my case it is http://8a6***04.ngrok.io

If i try to access this address on my browser i get :

localhost via ngrok

Now let’s have fun testing my website with Google Structured Data testing tool. Don’t forget to add the directory where you installed your website to the ngrok URL.

Here i see that i have 6 warnings on Schema/event that i should repair 😉

structured data testing tool

Final notes :

  • If you have errors, verify that ngrok session is online and you don’t have a robots.txt blocking Google
  • This technique is useful to test many technical SEO stuff (crawl, performance, JS…)
  • It could also be useful for multi-device testing or remote Dev-SEO visio

Leave a Comment