Apache Multiview Support Added

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://khlo.co.uk/?s=%s to http://khlo.co.uk/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.

5 thoughts on “Apache Multiview Support Added

  1. 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.

    • Hi khio .htaccess file create in parent folder and write content Options +MultiViews then if your url contain filename its convert into filename.php

Leave a Reply

Your email address will not be published. Required fields are marked *