Warning: main(includes/akismet_class) [function.main]: failed to open stream: No such file or directory in /home/miller/public_html/comments on line 5

Warning: main(includes/akismet_class) [function.main]: failed to open stream: No such file or directory in /home/miller/public_html/comments on line 5

Warning: main() [function.include]: Failed opening 'includes/akismet_class' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/miller/public_html/comments on line 5
Pretty Permalinks - Storymiller.org

Pretty Permalinks

By default Storymiller stores posts with a unique permalink identifier as well as unique more cryptic identifier for internal use. The permalink is constructed from the post title with some exceptions. Permalink has no spaces and punctuation is converted into underscore characters. While permalink is almost human readable the internal identifier is not. This id is randomly created and contains mixed letters and numbers. Post titles must always be unique in order to find the post in the archive. Storymiller archive is one huge collection of posts. Unlike some other blogging software Storymiller does not store posts categorized by months and years.

The default installation of Storymiller shows posts using the permalink. In case you’d like to access posts as they had been ordinary web pages, you must turn the Apache rewrite engine on. An ordinary web page ends with .htm or .html file extension. This gives an illusion having your site composed of individual pages. Of course, your website has no such pages but posts with similar permalinks. The permalink is turned as a web address and the rewriter module redirects such page requests to correct posts in your blog. First the links to posts look like this:


http://www.somesite.com/comments/permalink

Setting up the rewrite module of the web server you can make pretty permalinks, that look like this:


http://www.somesite.com/permalink.htm

Note that we have added the file extension .htm at the end of the address. Now that each post is addressed with page name the permalink must be unique to distinguish posts from each other. The url.post value in the settings file modifies how web addresses to the posts look like. The following values in settings file do the trick:


$blog["url.post"] = "<permalink/>.htm";
$blog["url.permalink"] = "archive/<Y/>/<n/>/<permalink/>.htm";

The first setting tells Storymiller to construct post addresses from the permalink by adding the .htm file extension at the end. The other setting tells how to construct permanent links to archive. The syntax explained:

<permalink/>
Placeholder for the post’s permanlink
<Y/>
Placeholder for year number with 4 digits
<n/>
Placeholder for the month number

In addition to these settings you need to turn the rewrite engine on. To do this you must modify or create the .htaccess file in your web server’s home folder. This is usually the root. In case you cannot find this file you must create one. The file is an ordinary text file containing the following lines:


RewriteEngine on
RewriteRule ^(.*).htm([l]?)$ /comments/$1 [QSA]

The first line turns the rewrite engine on. The other file instructs the module how to handle page requests. This filter finds all pages ending with .htm or .html file extension. The rewriter then redirects such requests to index page in the root folder. The requested page is passed as a parameter to the index page (see $1 parameter placeholder). Finally the [QSA] flag appends the query string, or the requested address, at the end of the redirected address.

You now have what we call pretty permanlinks. These usually are easier to remember and address.

Posted by Matti Mattila on Sunday, Dec 17, 2006 at 3:28 PM

Write a Comment | Documentation | Link

Related posts

permalink

Write a Comment