Few things to note on the process of bringing this site to life…
I developed this site locally on my Mac at first – using MAMP*. Lots of new content added to make this a useful portfolio site.
Previously when developing WP sites I’ve never added much content locally – just built frameworks for other folks. This time I added a load of big files and went through few iterations of thumbnail sizes etc and wanted to work on my local server to crunch through this.
Changing hard-coded URLS.
Other than hard-coding the domain in wp-config.php there’s more to do – as all your images and internal site links will probably have fully qualified hardcoded URLs.
Thanks to this guide to migrating wp – spark up phpMyAdmin and go through the following queries, one at a time. Change example.old to example.new as required:
UPDATE wp_posts SET guid = replace(guid, 'http://example.old','http://example.new'); UPDATE wp_posts SET post_content = replace(post_content, 'http://example.old', 'http://example.new'); UPDATE wp_posts SET post_content_filtered = replace(post_content, 'http://example.old', 'http://example.new'); UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://example.old', 'http://example.new'); UPDATE wp_options SET option_value = replace(option_value, 'http://example.old', 'http://example.new') WHERE option_name = 'home' OR option_name = 'siteurl';
Set up redirects from the old site
This domain is the new home of my – mostly coding notes – from my old blog at laydada.com.
Because I thought I’d be clever 10 years ago and customise the date pattern for my post URLs this job was a little more involved than for a regular move.
Back then I thought “example.com/2006-05-04/post-name” was much simpler than “example.com/2006/05/04/post-name”.
Hyphens vs slashes.
To turn those hyphens into forward slashes I’ve set up a really very handy WordPress redirection plugin to help. This plug avoids the need to edit the .htaccess file and leaves access to the WP backend in case I need it. Get with the regex already…
Settings to use in the Redirects panel
First redirect:
Source URL: ^/([0-9]{4})-([0-9]{2})-([0-9]{2})/(.*)$
Target URL: https://www.qreativbox.com/$1/$2/$3/$4
HTTP Code: “301 – Moved Permanently”
Then, to catch everything else, a second redirect:
Source URL: ^/(.*)$
Target URL: https://www.qreativbox.com/$1
HTTP Code: “301 – Moved Permanently”
Next up I should submit a change of address to Google Webmaster Tools …
* Seems funny that I hated MAMP so much but too many Mac OS updates messed with my local environment.
Learning how to configure a local dev environment was very educational the first couple of times but it seems that Apple moves significant bits around with every major OS update.
Paying a few euros to never have to spend a few hours finding out what has changed is fine by me now.
Last updated on 20th February 2020
Leave a Reply