View Full Version : Multiviews support
molespf
07-06-2007, 09:32 AM
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
07-06-2007, 03:14 PM
Please try a simple rewrite rule in .htaccess to rewrite the rule from foo to foo.php for you.
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.php -f
RewriteRule ^(.*)$ $1.php
molespf
07-06-2007, 03:28 PM
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
mistwang
07-06-2007, 03:43 PM
Yes, absolutely.
mangochutney
05-26-2009, 07:16 PM
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]