1

This question already has an answer here:

So I have been working with Wordpress for almost a year now, almost all of the times i get stuck with the same problem.

When you purchase a hosting you need to give it the domain of the website, now if the domain dont have A record to your host you won't be able to view your website, so you must edit your local hosts file to view it with this domain.

The other option is to work with a sub-domain, which here starts my problem. when you are working with Wordpress it's creating the pages with the Url on the database and than when you finish the website and want to connect to the main domain you need to edit the whole database. (Lets say the wanted domain is xxx.net, and the temp/subdomain is yyy.net)

What are the best ways of moving and connecting the website to the domain after using a sub/temp domain?

marked as duplicate by cjbj, Dave Romsey, fuxia Oct 30 '16 at 13:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

So basically you want to change the URL from subdomain to main domain in your DB so that it will work with your main Domain.

What I do is I use search & replace DB script and in this I will enter my subdomain to search and to main domain to replace.

You can download that script from here and keep the PHP file in the server. https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

Thanks

  • 1
    Don't keep the file on the server though - it's a massive security risk. Delete it once you're done. – Tim Malone Oct 26 '16 at 18:23
0

In fact, when i work with subdomain, you just have to care to create every link relative and not absolute ->

/wp-content/upload/...../image.jpg and never http://yourdomaine.com/wp-content/....

And after just change url website on options in database and all will work fine, sometimes you have to regenerate permalinks.

Not the answer you're looking for? Browse other questions tagged or ask your own question.