WordPress in IIS7

Slickhouse.com has been running on a dedicated Windows Server (2003) with Internet Information Services (IIS6) for nearly 6 months now - without any issues.

The initial setup proved to be a big headache, as PHP wouldn't play ball with my network setup. But after many hours of trying, I finally cracked it and migrated all of my Linux (shared) hosted sites to my very own server(s).

With the arrival of Server 2008, Microsoft has introduced IIS7 - which proves to be feature rich and secure. In most cases, I'd stand by the philosophy:

If it isn't broke, don't fix it
But in this instance, upgrading to IIS7 would be beneficial, no only for the aformentioned improved security, but also (hopefully) a performance gain.

Microsoft has greatly improved its online resources over the recent years, with IIS gaining its own site. There are plenty of tutorials, including the following:

Follow the first and you'll successfully end up with a working PHP platform, on top of which you can install WordPress. In my case, MySQL is on a separate dedicated server - but it would also work locally.

The second article is vital for the permalinks that WordPress uses. A default install uses a crude URL with QueryString parameters (i.e. /index.php?post=123), but permalinks enable friendly URLs such as /2009-04-24/wordpress-in-iis7/

There's not much else needed and from my initial testing, Server 2008 and IIS 7 play ball very well with PHP/WordPress. I'll soon be moving all of the sites on my IIS 6 webserver across, allowing me to take advantage of the new platform. I'll keep you updated!

comments Posted: Friday 24th April 2009, 14:07pm
Categories: Computers and Technology, Slickhouse, Web
Tags: iis, php, server-2008, wordpress

Update WordPress author

Like me, many of you may have installed WordPress and begun using it as the default administrator account - admin.

The problem is, you'll later wish you'd created your own user account, which would have been tied in with each of your posts and comments. Up until 2 minutes ago, all my posts were created by admin and all comments written by me had the name admin assigned to them.

There are several options if you're in this scenario - including creating a new account and ensuring all future posts/comments use it or updating all existing records with your new account details. I opted for the 2nd option and began by working out what users were currently in the slickhouse WordPress database:

SELECT ID, user_login FROM wp_users

This will return a list of all IDs and user_logins from the wp_users table within the database. In my case, slickhouse has just the one user - admin. It's then a case of updating the user as necessary. Start by selecting all columns for the previously returned record (which had an ID of 1):

SELECT * FROM wp_users WHERE ID = 1

This returns all columns for the user admin in my case. From the results, I chose to update the following columns:

To do this, you'd run the following SQL command:

UPDATE wp_users SET user_login = 'example', display_name = 'example', user_firstname = 'example', user_lastname = 'example', user_nickname = 'example' WHERE ID = 1

Replace example with what you'd like each column to be updated to. As we've just updated the existing user, there's less work to do - the wp_posts table doesn't need to be touched, as it references the wp_users by the ID field, that hasn't changed. However, wp_comments is a different story and does need updating:

UPDATE wp_comments SET comment_author = 'Example', comment_author_email = 'example@example.com', comment_author_url = 'http://example.com' WHERE user_id = 1

This will update all comments that are associated with your admin account, to the new details. Replace example in the above with all of the information you updated the admin user to previously.

And that should be it! I carried out all of the above using the MySQL Query Browser, which can be downloaded from the MySQL site. One word of warning - ensure you've got a backup of your database prior to carrying out any of the above. Make a note of what you update, so that if you do run into difficulties you can update the records back to what they were originally - or if all else fails, restore from your backup. Again, a backup can be accomplished using the MySQL Administrator.

comments Posted: Monday 22nd December 2008, 14:07pm
Categories: Slickhouse, Web
Tags: mysql, sql, wordpress

Updating WordPress Permalinks

After ironing out all of the bugs with my latest theme release, I decided to update the permalinks used throughout slickhouse.com

Thanks to WordPress' intuitive admin interface, this is a simple process:

admin

Most WordPress users opt for the Day and name Permalink structure, which would appear as 2008/05/04 for today. However, to a search-engine spider, this already looks like the links is 3 directories deep, before it even gets to the post title itself.

To counter this, I've amended the permalink structure to mirror the ISO 8601 standard for date (minus the time) - so today reads as 2008-05-04. To a search-engine spider, this would appear as just the one directory, within which the post title is situated.

There is a downside to amending permalinks to a WordPress blog that has been live for several months (even years) - all of the current links will effectively be broken. You could use a redirect script, that detects the user is trying to visit an older page - which would redirect them with a 301 (permanently moved) redirect to the amended url. However, this would still mean that your older links are present in your data.

To resolve this, you can amend all occurences of the older permalink to the new format. So, you'd look for 2008/05/04 and replace it with 2008-05-04.

sql

Using MySQL Administrator Query Browser, you can query the WordPress database, as above. The first step is to ensure you're querying the correct database (essential if you have multiple databases on the one server):

Use [database-name]

Where [database-name] is the name of your WordPress database. A standard install usually prefixes the database name with wp_. Execute the above and you'll see the correct database highlighted in the right-pane. Next, you want to begin searching for posts which contain the old permalinks within the content:

Select ID, post_title From wp_posts Where post_content Like 'example.com/2008/%' Order By ID Desc

If your WordPress database is fairly small (<500 posts), then you should find that the above query executes almost instantly - leaving you with a list of all posts that use the older permalink structure. You'll need to replace example.com with your domain name and run the query several times - once for each year your WordPress blog has been active, amending the year each time (2007, 2006 etc.).

Once you've got your list, you can start editing the posts to update the permalinks used. This could be achieved using SQL, but I would recommend doing it post-by-post to save any headaches if your update query goes horribly wrong!

Using the WordPress admin (Manage > Post) you can edit each post using the HTML view:

post

After editing a few, you'll soon quickly spot the a tags, ready to update them. In my case, it was simply a case of replacing the / with -, so 2008/05/04 became 2008-05-04.

There was a reason the SQL query brought back both the ID and post_title - as you'll soon find out when trawling through the admin. The admin orders (by default) the posts by ID, which means ordering the results of the Select query should make finding the offending posts a lot easier. To make things even simpler, you can amend the URL each time you have finished editing the one post and are moving onto the next:

url

As you'll see - the post.php references the posts by their IDs.

Once you've updated both your permalink structure and your content of each post, you'll be left with a fully working site. However, you may also want to notify the major search engines of your recent update. For this, I can highly recommend the XML Sitemap plugin for WordPress. After setting it up, it will generate an XML Sitemap of your WordPress blog and simultaneously notify each of the search engines of the updated sitemap.

Then, it's just a case of sitting back and awaiting the spiders as they begin to crawl your new, friendlier (in theory) permalink structure. If you haven't already setup Google's Webmaster Tools, then now is a good time - as it will help diagnose any issues with your new permalink structure.

Finally, if you don't have direct access to your WordPress database, then you could try using the built-in search facility, as seen in use on many themes. Simply search for your older permalink structure and it should disply all relevant posts.

comments Posted: Sunday 4th May 2008, 14:07pm
Categories: Articles, Articles, Slickhouse, Web
Tags: google, permalinks, sitemap, wordpress

Not long until Christmas!

It's not long until Christmas now! I calculate about 27 days left until the big day...

This year has flown by, but no doubt 2008 will too. It has been over 2 years since we finished University, but it feels like only last month. Slickhouse has been using WordPress since November 2005 and Slickhouse.com was first registered on the 4th October, 2004.

Here's to the last month of 2007 and the run-up to Christmas. I hope you like the Christmas-y feel going on here too!

P.S. You may need to hit ctrl + f5 to force your browser to reload the page - in case it's caching the old (not-so-Christmas-y) background.

comments Posted: Wednesday 28th November 2007, 14:07pm
Categories: Slickhouse
Tags: christmas, slickhouse, wordpress

Subscribe to comments

Thanks to Chris @ CSS-Tricks (for recommending the plugin), Slickhouse now has a 'Subscribe to comments' feature.

When replying to posts, simply tick the box below the Submit button that says "Notify me of followup comments via e-mail" and it'll do exactly as it says on the tin, well screen.

For those of you using WordPress you can get the plugin (currently version 2.1) from TxFx.net. To implement it is a doddle.

comments Posted: Monday 26th November 2007, 14:07pm
Categories: Slickhouse, Web
Tags: slickhouse, wordpress