Multiviews support

Discussion in 'Apache Migration/Compatibility' started by molespf, Jul 6, 2007.

  1. molespf

    molespf New Member

    my web host just switched from Apache to Lightspeed and now half my site is not working. Before the switch used to bring up pagename.php. Now I get a 404 error unless I add .php to all of my links.

    I have searched the forums for Mutiviews and nothing I've seen has worked for me.
  2. mistwang

    mistwang LiteSpeed Staff

    Please try a simple rewrite rule in .htaccess to rewrite the rule from foo to foo.php for you.

    RewriteCond  %{[SIZE=-1]DOCUMENT_ROOT}/[/SIZE][SIZE=-1]%{REQUEST_URI}.php -f
    RewriteRule ^(.*)$  $1.php
  3. molespf

    molespf New Member

    Wow... I wish I would have posted this two weeks ago when I started having the issue. That worked great. Can I duplicate that code for html and htm files? For example:

    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.html -f
    RewriteRule ^(.*)$ $1.html


    RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.htm -f
    RewriteRule ^(.*)$ $1.htm
  4. mistwang

    mistwang LiteSpeed Staff

    Yes, absolutely.
  5. mangochutney

    mangochutney New Member

    If you have a URI scheme like this, utilizing PATHINFO:
    /topic/Office/Work -> /topic.php/Office/Work
    /update/Office/Work -> /update.php/Office/Work
    /topic-> /topic.php

    # Multiviews
    RewriteEngine On
    RewriteCond %{REQUEST_URI} !.+php*
    RewriteCond %{DOCUMENT_ROOT}/$1\.php -f
    RewriteRule ^([^/]+)/?(.*)$ $1.php/$2 [L]

Share This Page