urls – How to deal with WordPress on localhost

Question

Although the accepted answer looks to be a good one, just changing WP_SITEURL/WP_HOME doesn’t work in my case because there always ends up being lots of absolute links in the text content on pages (i.e. images or links added through the WYSIWYG editor). In other words, I pretty much have to use the same domain if I want the site to work properly.

So in case it helps someone else who comes across this, my solution was an outside-of-Wordpress one – although it may not help in all cases.

I use a domain, for example me.mycompany.com, and then in my HOSTS file I make it resolve to 127.0.0.1 (in other words, localhost). For any of my colleagues who need to view the site, I add my domain to their HOSTS file with my local IP.

This solution also gets extended when clients outside our network need to view the site; we simply make sure me.mycompany.com resolves to our public IP (usually your web host can help with this, and it definitely helps if you have a static IP for your Internet connection too), and then at our router, route the web requests to my internal IP, effectively setting up an easy web hosting solution (for development only of course, not production!)

Hope this helps someone. The HOSTS file can be edited on any platform, obviously the instructions differ for Windows, Mac and Linux so best you Google for help if you need it, but in Windows the file is C:WindowsSystem32driversetchosts – open it in Notepad and make the neccessary changes, following the format in the file (you will need to run as Administrator in order to save the file).

0
user1778856 6 years 2015-05-04T14:16:16-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse