Some of our users had difficulties with using Elfsight Apps in this scenario, as it requires a website to use its apps. Localhost can’t be registered as a website. Since we realize how crucial it often is to get the actual look and feel of the site before publishing, we offer the following solution for this issue.
Connect to Elfsight Apps via virtual host
There is a way to run any of Elfsight Apps on a localhost. To do it, you need to set up a virtual host. If you set a virtual host, it will allow you to work with your local server site (localhost) via the domain name that you set as a virtual host.
Tip: use your future domain name as your virtual host
We recommend to use your future domain name as your virtual host. In this case you won’t have to make any changes on Elfsight Apps side after your project goes live. All of your widgets will just keep on working right where you’ve placed them!
Setting up a virtual host
So how do you set up a virtual host? Each OS does it in its own way. Right now we’re happy to offer you the solutions for the major operational systems – Windows and MacOS and Linux.
First, you need to find and to open the “hosts” file in a text editor. Depending on the operation system, it can be found at:
- Windows:
C:\Windows\System32\drivers\etc\hosts
- MacOS:
/etc/hosts
- Linux:
/etc/hosts
Next, add the following line to the file:
127.0.0.1 mytestsite.com
Don’t forget to replace “mytestsite.com” with the name of your website’s domain.
After you do this, you can use the domain you’ve specified when setting up an app at Elfsight Apps.
Disabling the virtual host
Virtual host can be a great help when developing your site, but once it’s gone live you might no longer need it. So how do you disable a virtual host?
To do it, you need to open the “hosts” file you’ve edited before to get it to work, and to delete the line you’ve added to it.
Disabling a virtual host will in no way influence the work of your widgets in case you’ve followed our recommendation and used the same domain name in virtual host. They will keep working just fine.
We hope that this information will be of use to you. However, if you still have any questions concerning virtual hosts, or any questions or feedback on Elfsight Apps, you’re welcome to contact our Support Team! Please, email us at [email protected] or open a ticket in our Support Center and we’ll be happy to help!