So among several other things, I’m a geek. Partly by nature, partly by accident, and partly because smart chicks think geeks are hot.
I’ve been proudly using WordPress for a couple years, and continue to be, well, pretty geeked on it. It’s an elegant script, beautiful in its simplicity. As they say, “code is poetry”.
I just tackled an issue I’ve been thinking about for a while now. This blog was originally installed into a subdirectory on my domain, which I named quite appropriately, “blog”. The core install of WordPress resided in this /blog directory, and the address to it was http://jaced.com/blog/.
I’ve been meaning to move the blog to the root of this site, but there were a couple significant things to consider:
1. Many links to this site are already established on the search engines, and Google sends me quite a bit of traffic. For instance, if you were to Google “U2 Riddle“, this site would be ranked at the top of the results. If I just move my blog elsewhere, even if it’s simply up a level on the same domain, the Google links would throw up thee ol’ Page Not Found 404 error. Not good.
2. I hate clutter. WordPress consists of many files and directories, and it’s best, if possible, to keep it all in a single directory. This becomes an advantage on a regular basis when it comes time to perform updates. The idea of having WP files scattered in my root directory with everything else gives me a headache.
So I had a unique situation. I wanted to have WP answer on the jaced.com root, I wanted to keep my root directory uncluttered with WP files, and I needed to address the issue of redirecting old traffic to http://jaced.com/blog/yadayada to http://jaced.com/yadayada.
Situation resolved, but not without some careful thinking. First, WordPress already has the ability to have the “Blog Address” (where the world sees it) be different than the “WordPress Address” (the location where the core script files are stored). So I got that going for me, which is nice. Since I already had my core files in /blog, all I needed to do was tweak the index file, modify some rules in the .htaccess, and move them to the root of the domain.
Now I needed to address the issue of the redirection of the Google traffic. The way to do this is with a 301 Redirect in the /blog/.htaccess file, which is basically:
Redirect 301 /blog http://jaced.com
So far so good. After I set up the 301 Redirect in /blog/.htaccess, everything was fine on the surface. But…
Major problems. Since all queries to /blog were being redirected to the root, I suddenly found myself unable to get into my admin panel. Additionally, WP themes weren’t being found for the same reason.
Spent a couple days talking with the boys over at WordPress, and the whole issue of redirection seems to be a bottomless chasm of unresolved questions. It’s really a game of jumping in there, hacking away, and sharing what you learn. Hopefully somebody will have gone through what you’re experiencing so that you can save yourself some time.
Not so for me.
So I was in a unique situation. After sleeping on it, I had that Eureka moment. It occured to me that the idea of using the /blog directory as the location for the core files was conflicting with the need to redirect queries to /blog. Rather than wrestle with that any longer, I figured to create a second subdirectory for the core files. The purpose of the /blog directory would be to simply house the .htaccess file with the 301 redirect.
It works like a charm, but not before having one final boxing match with the root’s .htaccess file. It refused to be updated, resulting in busted Permalinks. (Note to Self: chmod the .htaccess file to 666 first, update the Permalinks, and then put it back to 644.)
I suppose one could say that this site has been taken up to a whole new level.
The thread on all this jibberish is here.