I am in marketing, not IT/development so forgive my non-technical description:
I have been tasked with a complete redesign from a no-CMS website with very little in the way of resources or support, as we are a small school, and I have limited technical knowledge. I have one web coordinator also on the project.
We are approaching launch of our new website, built in WordPress, and using an external host, ServInt. During the build, we beta launched the site under the beta. subdomain, as our existing website was still live and the primary site.
We (marketing) as project managers for the redesign have just come to the realization that we will need to go through and remove the "beta" from URLs after launch when the site goes live and takes over the domain without the "beta" or the links will break. This means many, many hours of doing this manually. We had been advised previously that the URLs with beta would continue to work.
Are there any scripts that will do a global "find and replace" across a WordPress multi-site set-up, or any other solutions we can look at?
Also, aside from on-page hyperlinks, how will page URLs be affected? We are in the dark at this point and in need of technical advisement on how best to proceed to be in line with best practices. Our IT dept. is understaffed, over capacity, and was not involved in the project (if that is not already obvious).
Do you want all URLs to change from something like:
We've done this in the past, in the database itself using this script:
It will allow you to safely do a find/replace across your database. As
always, it would make sense to test this on test data before doing it
on you live data. And make backups. :)
I owe you big time, my friend. ;)
This plugin also worked for me in the past. http://wordpress.org/extend/plugins/root-relative-urls/
Thank you!! I like having options. ;)
Sarah - Here are the 4 SQL queries to do a find and replace for all URLS both in the content and the permalinks. I use this all the time when I move sites from local development to live sites. Your database manager will know how to run these queries. It takes just a few minutes to do (but always backup your database beforehand). The only things you will need to modify are the two URLS, and the wp_ if you changed the table prefix when you installed Wordpress.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.oldsiteurl.com','http://www.newsiteurl.com');
awesome - thank you!!
Cara, doing it this way could break any serialized data (in wp_options), though. Just something look out for.
One symptom of broken serialized data is that your widgets lose all their settings after the find/replace.
Thank goodness for the tech people in the audience. My hat is off to both of you, Cara and Bill.
Bill, I've never had that issue as I'm only changing the home and siteurl fields in wp_options table
Ah yes. Good point. Thanks for clarifying!
It's a good point though. You don't want to do a simple search and replace of the sql file in textedit, losing your widgets can be a big ol pain.