Search code examples
wordpressurlhyperlinkhrefportfolio

How to prepare all urls for a transfer from: Domain/ftpfolder/page to domain2/page?


Right now I'm bulding a wordpress website on my server. Urls are http://domain.com/ftpfolder/page
Problem that I have is that I'm going to have to transfer this website to the client's server and links will be like this http://domain2.com/page

Wordpress Address & Site URL can fix this easily, however, not all links in the website will be changed as some of them are entered manually. I did the test already.

My question is: How do I write all images/pages links in order to be ready for the transfer?

I thought I could name all of them <a href="./page"> but this creates mistakes for some links.
For eg. I have to some images in a page called "expertise": http://domain.com/ftpfolder/expertise

I want each image to link to a specific product (wordpress portfolio), for example: http://domain.com/ftpfolder/portfolio/product1
If I use <a href="./portfolio/products1">, then the link becomes:
http://domain2.com/expertise/portfolio/product1 which doesn't work because /expertise/portfolio doesn't exist as mentioned two lines above (because I'm using wordpress pages and portfolios, so categories are bypassed)

So should I write all my links: http://domain.com/ftpfolder/... and then replace this by http://domain2.com/... in the database? If yes, how do I do it?
Or is there another technique I'm not aware of to simplify my links?
Or should I rethink the way my content is organised, but I'm not sure how.

Hope this makes sense, sorry for my bad English. Thanks in advance for your feedback.


Solution

  • Use "Search and Replace Script" as advised by the WordPress Codex.

    Use to replace 1 with 2:

    1. domain.com/ftpfolder/page

    2. domain2.com/page

    Oh, did I tell you to do a backup first?