Apache Multiview Support Added

September 29th, 2005

I just added support for Multiview - you can access blog entries via /index.php/Object-Alias. This is the same as the old URLs which used to be index.php?s=Object-Alias. This was mainly to produce cleaner URLs, improve search engine indexing, and produce better statistics in AWStats :) This script is designed to be used with mod_rewrite/Multiview. There are no hacks - all you do is change the object url in the configuration file from http://cow.neondragon.net/?s=%s to http://cow.neondragon.net/index.php/%s. The template engine generates all the URLs used via a makeLink() function.

The code on the server which takes the index.php/Object-Alias and converts it into a more sane form looks a bit like this:


<?php

/* Apache Option Multiview */

$multiviewBase $_SERVER['SCRIPT_NAME'].“/”;

if (!isset(
$_GET['s']) && substr($_SERVER['PHP_SELF'], 0strlen($multiviewBase)) == $multiviewBase) {

    $_GET['s'] = substr($_SERVER['PHP_SELF'], strlen($multiviewBase));

}

?>


Edit 29/9 22:25: Fixed broken PHP.

  • Uncategorized
  • Comments(4)

Related Posts

  1. Zend Framework Search
  2. Annoying things about PHP
  3. Namespaces and Objects
  4. Geneone 0.4.6 Upgrade
  5. Geneone Update: Search, Login Throttling

4 Responses to “Apache Multiview Support Added”

  1. Nolion 02 Oct 2005 at 11:37 am

    Interesting, can /index/ also be used?

  2. Khloon 02 Oct 2005 at 12:09 pm

    It seems not to work. I would have thought that Apache Content Negotation would have allowed /index to show /index.php though. Not sure if this is because of the php file extension or because of the server configuration.

  3. Nolion 02 Oct 2005 at 1:31 pm

    On my local server, it works. It is really strange that it doesn’t allow it here.

  4. Khloon 02 Oct 2005 at 6:54 pm

    Doesn’t work on my localhost - must be a configuration thing.

Trackback URI | Comments RSS

Leave a Reply