I’ve had a bit of a nightmare with a WordPress set up recently and need to document the process and solution here:
I’ve recently found a way of creating a site mirror and then removing that mirror to go live, which makes for a smooth deploy. Win. It goes like this:
Add a new subdomain mirror at the host (Dreamhost): eg: test.mm.com
Go to the Domain Registrar (eg: 123 reg) and add an A record for that ‘test’ subdomain, with the value matching the IP on the host, eg: 18.104.22.168. You can find this IP by clicking on the DNS link and scrolling down the page.
Now wait a few hours for it to propagate – doing this the night before is a good idea.
Next FTP: this time you’ll be connecting to your webserver (not the subdomain). For me Dreamhost shows my servername in the account status panel. Contact support for yours – tell them you want to access your hosting before you make a nameserver switch. For example mine could be http://monkeynuts.dreamhost.com. Once logged in, you can add files in the usual manner.
To view the files in the browser, go to your subdomain.
When you’re ready to go live, do this:
Set up a WP maintenence plugin – not needed, but my preference.
check (copy) the current nameservers. (incase you need to put them back in)
Back up the .htaccess and wp-config files via ftp – just in case!
change the nameservers with the domain registrar. I didn’t delete the A record I created earlier btw.
IMPORTANT! update the WP site uri to treatingautism.co.uk. If you don’t do this your site will break! Make sure you have this page open in a browser ready to do this when you make the nameserver switch.
go back to the webhost and deactivate the mirror.
This is where my problem started. I know the DNS will take a while to resolve, but for me I found I had some browser caching issues (Chrome). Therefore I had to add the domain and IP to my systems hosts file. Which for me can be found here:
Look for the ‘hosts’ file, copy it to the desktop, right click and ‘open as administrator
under this line:
# ::1 localhost
[Your IP address] [leave a space] [yourdomain.com]
Save it, then drag it in to the /etc directory and overwrite the existing file.
Now open it again and make sure your computer has saved it correctly – some Windows/Antivirus software prevents this. If so, disable it and try again.
Now try visiting the domain in a different browser – eg: FireFox.
If you still have problems, contact the webhost support and tell them what you’ve done.
Hopefully you should successfully see you site now.
Cheers – Mark