WordPress – when life needs a change

So, your blogs feeling a bit left out, your web directory resembles a 12 year olds bedroom and its time to pull up your pants, well with the worlds most popular blogging software (amoungst other uses) things are not necessarily that easy to shuffle and move around, especially when you want to change the URL and also the fullweb directory path! Nontheless it can be done, but be prepared, its not a five minute job, probably a half hour one 🙂

Onwards and upwards…here are my notes, cause I am gettign old and I will forget this after lunch  : -/

Relocating blog to another directory!

log in to the blog and change the URL for the blog under the settings
WordPress address (URL)     http://blog.avernus.com.au
Site address (URL)    http://blog.avernus.com.au

save, then relocate the files to the directory – in this case it is the root directory for the virtual host.

Eerything kinda works after this?! however major problem exists with the file path for the uploads, surely one would think they would have sorted this shit out by now!

Anyway, the plan is to take the database file, in the form of a sql dump and use a handy program to search within it to find and replace certian strings, in particular the paths, once the sql has been modified it can be reloaded into the mysql system and hopefully things will work again.

Now in this case, my system not only changed the directory/path but also the web address, ie it went from being buried deep in the file structure to be being in a toplevel directory in the /www/ directory and also had teh domain change to a subdomain.

So in this case it was a two step process to find and replace the strings! the first to find and replace the path relative to the root directory;

ie find;

/hello/directory/here/bog/wp-content/uploads

to:

/wp-content/uploads

Note; this is relatively to the ROOT path of the webserver or virtual host! so do not include the ‘blog’ part of www.hello.com/blog

the next step replaced the web address

find:

www.hello.com

to

blog.hello.com

however remember that the WordPress options must be set to the subdomain root directory!
ie

if the server address is:

/www/html/blog

and the domain is:

blog.hello.com

make sure the address in wordpress matches and is not blog.hello.com/blog !

man, it took me a few goes even the second time around!

Now the program to do all this was

SCR  1.0.002 Freeware edition

“SCR finds and replaces text within multiple files.
It supports previewing, case-sensitivity and
various search options.”

It is also very prudent to make backups of the sql files since it took me several goes to get it right.

But, its not all over yet!

this breaks a few things in the blog, namely some template options and web addresses, these can be easily fixed though! ie Permalinks…

You must also check and edit ‘store uploads folder’ under Settings-Miscellaneous or all your new uploads will continue to go into the old folder.

Email this to someoneTweet about this on TwitterShare on FacebookPin on PinterestShare on LinkedIn

Leave a Reply

Your email address will not be published.