I’m doing some changes to this WordPress site and wanted to get out of the loop of FTPing a new version of my CSS to the live server and refreshing the browser. Rather than clone the site and setup a dev server, I wanted to host it on my local machine so the cycle of changing and testing would be faster and I could work online.
Nice people on Twitter recommended Local By Flywheel which was easy to install and get going (no dependancy rabbit hole) and which allows you to locally host multiple sites. It also has a really intuitive UI.
To clone my live site, I installed the BackUpWordPress plugin, told it to backup the MySQL database and the files (eg, the theme, plugins etc) and let it run. It exports a file that Local by Flywheel can easily injest – simply drag and drop it onto Local’s start screen. (There’s a handy video that shows how to do it.)
For some reason, although I use the excellent Make Paths Relative plugin, the link to my main stylesheet uses the absolute path, so I edited my local header.php (in Users ▸ brucelawson ▸ Local Sites ▸ brucelawsoncouk1558709320complete201905241-clone ▸ app ▸ public ▸ wp-content ▸ themes ▸ HTML5 ) to point to the local copy of the CSS:
link rel="stylesheet" href="http://brucelawson.local/wp-content/themes/HTML5/style.css" media="screen".
And that’s it – fire up Local, start the server, get coding!
If you’re having problems with the local wp-admin redirecting to your live site’s admin page, Flywheel engineers suggest:
- Go to the site in Local
- Go to Database » Adminer
- Go to the wp_XXXXX_options table (click the select button beside it in the sidebar)
- Make sure both the siteurl and home options are set to the appropriate local domain. If not, use the edit links to change them.
(Last Updated on )
Buy "Calling For The Moon", my debut album of songs I wrote while living in Thailand, India, Turkey. (Only £2, on Bandcamp.)