Multiviews support

#1
my web host just switched from Apache to Lightspeed and now half my site is not working. Before the switch http://mysite.com/directory/pagename 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.
 

mistwang

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

Code:
RewriteCond  %{[SIZE=-1]DOCUMENT_ROOT}/[/SIZE][SIZE=-1]%{REQUEST_URI}.php -f
RewriteRule ^(.*)$  $1.php
[/SIZE]
 
#3
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

and

RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.htm -f
RewriteRule ^(.*)$ $1.htm
 
#5
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]
 
Top