Question

Currently, my workflow is to develop locally, and then place on remote server as key intervals. This has worked fine for a while, but since starting to do more AJAX work, I am finding it difficult to work with roots and hosts dynamically, and am having to write redundant code into my JS in order to make the same file work both locally and remotely.

Is there a good way to mimic a URL locally, or even just have each local site have a root level domain address (as apposed to localhost/my-dev-site) using MAMP?

Was it helpful?

Solution

Use a host file , point it to localhost

You mentioned MAMP, so I am assuming you are using Mac.

go to /etc/hosts and add this line:

127.0.0.1   www.whateveryoururl.com

OR

127.0.0.1   www.whateveryoururl.com whateveryoururl.com
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top