< 1 min read
My site pictures are stored on webserver (blog) folder under /images/ and all my links from this blog are linking to pc-freak.net/images/.. however recently I decided to run my own Content Delivery Network (CDN) to serve images with NGINX instead of Apache because this will save me a lot of Memory and increases significantly image picture download speed. For that purpose the easiest way is to of course redirect all images requests to NGINX server running on separate port 8080. But as the redirecting /images/ requests will have a minor negative effect on static content serve speed, I thought the best way will be to create / run a separate subdomain cdn.pc-freak.net on a separate IP address to serve blog linked images.
Then to achieve that, I needed a way to convert all my blog posts https://pc-freak.net/images/ string to http://cdn.pc-freak.net/ luckily there is a wordpress plugin to search and replace a string:
"SA simple search for find strings in your database and replace the string. You can search in ID, post-content, GUID, titel, excerpt, meta-data, comments, comment-author, comment-e-mail, comment-url, tags/categories and categories-description. It is possible to replace the user-ID in all tables and the user-login."
Using the plugin is straight forward:
wget -q http://thedeadone.net/wp-content/sw/Wordpress/searchandreplace.zip
warning [searchandreplace.zip]: 15 extra bytes at beginning or within zipfile
(attempting to process anyway)
To substitute any string within wordpress database login to WP-Admin Panel you will notice in:
“Tools” (section) -> "Search and Replace”
I've also made a download mirror of Search and Replace current latest 2.7 WP plugins here.