Moving WordPress and Yahoo Small Business Hosting
Oh, and if you find yourself in Milwaukee on October 9th, 1998, come find me at Jeff’s house party and point out the foolishness of accepting drinks prepared by strangers.
“I don’t care what you think, I’m going to do it anyway!” -or- “It’s too late! Help!”
I hate to burst your bubble, but the fact that you’re here now means that you never do get your hands on a time machine. You’re contemplating the move and wanting to make all the necessary arrangements in advance in order to smooth your transition, or you went ahead and tried it and found that everything is broken. I shall now provide you with the list of things I would have done if only I’d known them and the things you can do now to get yourself un-broke.
A bunch of my files won’t upload via FTP!
Problem: Blah. Yahoo Small Business Web Hosting’s FTP servers won’t allow you to upload a file with a name which contains parentheses.
Cause: The reasoning is sound in that parentheses aren’t considered safe for URIs (RFC3986 reserves parentheses as being undesirable in URI strings because they have the potential to break evaluations by regular expression).
Solution: If you find yourself in a position where you’ve uploaded or created files in your /wp-content/uploads directory which are using parentheses in their names you’ve got a couple of options.
- The first and best option is to do away with these files before migrating your WordPress site. Replace them in your Media Library and update your posts and pages. Problem solved.
- What I’ve ended up having to do is archive all of the files with parentheses in their names in a zip file and upload that. Then, one can use the FileBrowser WordPress plugin to open the archive.
Permalinks don’t work!?
Problem: That’s right. You’ve moved WordPress and now none of your links are working. Going to the admin panel for Permalinks and clicking ‘Update Permalinks’, as recommended by Yahoo’s help article, does nothing for you. Everything looks right, but all of your links are returning a 404 error.
Cause: Yahoo Small Business Hosting doesn’t allow the use of .htaccess files. They’ve told me during a few phone conversations (I’ve hassled with them a number of times now) that it’s for security reasons. Apparently the thing to do is flatly forbid your customers doing something perfectly sensible and commonplace rather than engineer your systems in such a way as to prevent abuse. I digress…
Solution: I found one solution which involves making custom permalinks which look like ‘/index.php/%postname%/’, but this is unacceptable to me because a.) it’s ugly, and b.) it will trash your SEO unless you set up 301 permanent redirects to reference your new, nasty URLs. Here’s the cleaner workaround:
- Rename your blog directory via FTP. For instance, if your blog directory is ‘/bar’, rename it to ‘/bar.TEMP’. If your WordPress installation is at your document root, move the entire contents of your document root into a new directory called ‘/bar.TEMP’.
- Log in to your Yahoo Small Business Web Hosting control panel. Click the ‘Create & Update’ tab toward the top, then scroll down and click the ‘WordPress’ link under ‘Blog Tools’.
- Complete this form. Pay special attention to Step 2. Also, make sure that Step 3 accurately reflects what you want your endgame to look like (If your blog directory above was ‘/bar’ make sure to roll this WordPress installation out to ‘/bar’, if you’re going to be using the document root leave the directory field blank).
- Let their roll-out process happen.
- Again, via FTP, either rename the ‘/bar’ directory to ‘/bar.YSB_Blah’ or move everything in the document root except ‘/bar.TEMP’ into a new directory. Then reverse the procedure from Step 1, above. This will convince Yahoo’s hosting provision that it’s okay to give you the rewriting you need to handle permalinks.
Now I need 301 redirects! FML!!
Problem: You’ve moved domains or directories and you need to do 301 redirects to prevent losing all your hard-won SEO. Now, after everything else, you discover that Yahoo Small Business Web Hosting’s limitations forbid you doing site-wide permanent redirects. Well, they’ve thoughtfully provided a utility I didn’t even bother investigating which would theoretically allow someone to upload a CSV file containing all their 301s.
BAAa-HAHAHAha! Seriously!? Like I’m going to waste any more time than I already have tripping through YSB’s bizarre, unwieldy tool set.
Cause: It’s that .htaccess issue again. The common sense way to do this on an Apache server would be to catch and rewrite all inbound requests using .htaccess, but Yahoo Small Business Web Hosting… Well, you know.
Solution: Rename the index.php file in the location which would have been the base of your previous WordPress install. Create a new, blank index.php and insert this:
- <?php
- $request = $_SERVER["REQUEST_URI"];
- $request_a = explode("/", $request);
- $count = count($request_a) - 1;
- $request_res = "";
- for ($i = 3; $i <= $count; $i++) {
- $request_res .= "/" . $request_a[$i];
- }
- header("HTTP/1.1 301 Moved Permanently");
- header("Location: http://www.newdomainfoo.com/bar" . $request_res);
- exit();
- ?>
<?php
$request = $_SERVER["REQUEST_URI"];
$request_a = explode("/", $request);
$count = count($request_a) - 1;
$request_res = "";
for ($i = 3; $i <= $count; $i++) {
$request_res .= "/" . $request_a[$i];
}
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.newdomainfoo.com/bar" . $request_res);
exit();
?>As always, you’ll want to make sure that the code you’re inserting is going to represent the reality of your situation.
In the arguments for the for loop at line 6, we need to initialize the loop at position 3 because we’re working with a request which would have originally included ‘/bar’. If your original URLs were for ‘www.olddomainfoo.com/bar’, you’ll want to leave it like this. If, on the other hand, your base URL was ‘www.olddomainfoo.com’, you’ll want to initialize $i at ’2′ instead of ’3′. Change line 6 to read:
- for ($i = 2; $i <= $count; $i++) {
for ($i = 2; $i <= $count; $i++) {Also, line 10 specifies the base for the URL you're going to be redirecting to. You need to make this equal the URL of your new WordPress location. Make sure there's no trailing slash.





