Static Homepages On A WordPress Site

NOTE! Due to a change in WordPress’s .htaccess commands, the following procedure does not work in WordPress 2 and above. The advice below seems to work in WordPress 1.5.x only.

Mikemariano.com runs WordPress from the root directory, meaning all of the feeds, blog entries, and pages get passed through http://mikemariano.com/index.php. Left alone, this would make the front page of my site my weblog, but I didn’t want it that way. I wanted a static introductory page, underneath which would be my weblog and my work. Getting this static page was easy: I wrote a webpage, named it index.html, and uploaded it to the main directory. I can’t vouch for everyone’s server, but on mine, index.html overrules index.php: type in http://mikemariano.com/ and my static homepage appears.

That takes care of the homepage; next I changed a few WordPress options to get my weblog where I wanted it.

In Options → General, my WordPress Address and Blog Address are both http://mikemariano.com (by default it has no slash; I don’t know why, but I’ve left it alone).

Why is the Blog Address not http://mikemariano.com/weblog? Because this would also effect the Pages WordPress creates, putting them as well as everything else in the weblog directory. Since I want my plays to be listed at mikemariano.com/plays/, I did not change the Blog Address.

But what about the archives, single entries, and categories? Things that are supposed to be within the weblog? These can be changed in the Permalinks menu.

In Options → Permalinks, my Permalink Structure has been entered as /weblog/%year%/%monthnum%/%day%/%postname%/. My Category base is /weblog/category.

Now individual entries, yearly/monthly/daily archives, and categories all fall within the weblog. Feeds and pages remain at the root level, which is fine with me. Only one thing is missing:

There is still no such thing as http://mikemariano.com/weblog/!

This requires changes outside of WordPress. I have added the following three lines to the .htaccess file on my server after WordPress’s automatic additions:


RewriteRule ^weblog/$ /index.php
RewriteRule ^weblog$ /index.php
RewriteRule ^weblog/page/?([0-9]{1,})/?$ /index.php?&paged=$1 [QSA,L]

Briefly, here is what those three lines are saying:

  1. When someone asks for /weblog/, send them to /index.php
  2. When someone asks for /weblog (no trailing slash), send them to /index.php
  3. When someone asks for a previous weblog page, send them there.

For a final touch, I have allowed my index.html file to be editable by WordPress. Using Manage → Files, I can edit my static homepage without ever leaving WordPress.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: