LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Feedback/Feature Requests > Multiviews support

Reply
 
Thread Tools Display Modes
  #1  
Old 11-20-2005, 12:35 PM
matt matt is offline
Member
 
Join Date: Oct 2005
Location: San Francisco
Posts: 37
Default Multiviews support

Apache does this cool thing with multiviews enabled where you can have a file like /about/contact.php and refer to it in a URL like /about/contact/ and it works. This is nice in that you don't have to make directories for everything. I would love a way to do this in Litespeed, either as a built-in feature or a rewrite trick.
Reply With Quote
  #2  
Old 11-20-2005, 12:47 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
Yes, you do that with a rewrite rule.
If a URL is ended with a '/', then strip the '/', append '.php', then test the existance of the file with a 'RewriteCond ..."

Something like:
Code:
RewriteCond %(DOCUMENT_ROOT}/$1.php -f 
RewriteRule ^(.*)/$    $1.php
Reply With Quote
  #3  
Old 12-25-2005, 09:14 PM
matt matt is offline
Member
 
Join Date: Oct 2005
Location: San Francisco
Posts: 37
Wow, that worked great.

Thank you! (And Merry Christmas. )
Reply With Quote
  #4  
Old 12-26-2005, 02:49 PM
matt matt is offline
Member
 
Join Date: Oct 2005
Location: San Francisco
Posts: 37
I needed two rules to get this to really work right:

Code:
# Multiviews
RewriteCond %{DOCUMENT_ROOT}/$1 -d
RewriteRule ^(.*)/$    $1/index.php

RewriteCond %(DOCUMENT_ROOT}/$1.php -f
RewriteRule ^(.*)/$    $1.php
Reply With Quote
  #5  
Old 12-29-2005, 08:50 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,583
There is a typo in the rule I posted, %(DOCUMENT_ROOT} should be %{DOCUMENT_ROOT} , otherwise, that rule will be ignored. :-)
Reply With Quote
  #6  
Old 05-26-2009, 06:07 PM
mangochutney mangochutney is offline
New Member
 
Join Date: May 2009
Posts: 2
Default Multiviews with PATHINFO

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]
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Subversion support? Martha Biggly Install/Configuration 10 04-01-2011 01:15 PM
max_execution_time did not changed piper Install/Configuration 12 01-24-2007 11:27 AM
Litespeed STD could support ssl? wpl12 Install/Configuration 1 11-06-2006 11:13 PM
Premature end of response header alex Bug Reports 10 06-11-2006 07:48 AM
RewriteBase support? jburks725 Install/Configuration 1 10-05-2005 10:45 AM


All times are GMT -7. The time now is 01:43 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.