• Greetings –

    I posted a week or so ago about the issues of migrating Wordspress sites – particularly the issues with domain name changes.

    This was prompted by my desire to develop my site off-line on my own MAMP server (Macintosh) and then move it to a server on the internet once it was complete. I discovered that too many elements of the WordPress site didn’t update to the new domain name. (primarily SQL database fields pointing to files)

    It occurred to me this evening that there might be a way to temporarily assign a domain to my Mac – so I could do my development off-line – and then simply copy the entire thing to my server in the cloud when I was done – assigning the domain I’d registered to that server’s IP address.

    Turns out I was right – and it’s pretty easy – although I haven’t tried it yet. Forgive me if this is obvious to a more seasoned WordPress developer. The link below is to an article that tells how to do this on a MAC – I expect there’s similar capability on Windows. (although I expect there might be problems with a wholesale copy of a WordPress site to a different platform – since the MAC is “UNIX-like” – it uses the same file structure as another “UNIX-like” server.

    If this idea has land-mines that I don’t foresee, I’d appreciate the feedback. I’ve been in I.T. a long time – but I’m new to WordPress.

    https://www.imore.com/how-edit-your-macs-hosts-file-and-why-you-would-want#page1

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Yes, Windows has a hosts file, too.

    And the method of using a locally defined domain (defined in the hosts file) is a good one, because it makes the transfer from development to production quick and easy.

    I concur with Steve.
    Configuring localhost to use the VirtualHost method is IMHO a well kept secret. For the life of me I do not understand why it is not widely promoted, that all the localhost WP docs stop short of explaining it is a mysetry.
    I have used the VirtualHost method many times, to develop websites and to troubleshoot sites which are unhappy for various reasons, like that they have been hacked. For many purposes the WordPress site barely knows that it has changed host, (I copy the database name + user + password, so that “wp-config.php” stays the same).
    Issues where the rehosting is not transparent include:
    – ssl and https
    – smtp and email configuration
    But these are minor.

    There are plugins like “Duplicator” which do a good job of renaming the site throughout the database.

    Thread Starter jgstroup

    (@jgstroup)

    Thank you gentlemen, for your informative responses.

    It had occurred to me that I’d have to take steps to ensure SSL was handled properly. Of course while on my own machine, it’s not necessary. So I was thinking have simply copying the entire root directory over to the “cloud” host, I could simply apply the SSL certificate at that time – and all would be well.

    I’m not all that well versed in SSL yet – so there may be considerations I’m unfamiliar with – and I’ll need to research.

    I’d totally forgotten about mail services – thanks for reminding me.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Assigning a domain to “localhost”’ is closed to new replies.