Wordpress hack: detecting login cookies when Wordpress is not installed at your blog URL
This is a technical description of a programming trick with the blogging engine Wordpress (which runs this blog). I know the useless blather you usually read–or, more accurately, ignore–here has nothing to do with programming, but bear with me for one post, because I think people searching on Google might find this trick useful.
UPDATE 9/26/09: This hack doesn’t actually work, because the login cookies need to be set to two different directories–your blog url and your Wordpress installation folder–in order for all parts of your blog to work. I’ll post a fix once I figure out a way around this. It won’t be pretty though, since Wordpress 2.8 hasn’t been set up to directly deal with this issue yet.
So Wordpress has a cool feature / semi-intentional built-in hack that allows you to install the Wordpress scripts in one folder (e.g. jueseph.com/blog), but have your blog URL be something different (e.g. jueseph.com). This is helpful for people who want to have a nice short URL for the blog, but don’t want to have to have all those ‘wp-’ scripts cluttering up their root directory on the webserver.
Unfortunately, this trick has a fatal flaw, which I noticed today when I was implementing it for a a friend’s new blog: Wordpress no longer recognizes that you are logged in, even if you are! (more…)