[SWLUG] Re: Discuss Digest, Vol 5, Issue 2

Justin Mitchell justin at discordia.org.uk
Sat Jan 8 14:13:34 UTC 2005


On Sat, 2005-01-08 at 12:45, bob wrote:
> HI
> How would the server know how to parse the page?
> 
> I to have this problem using php as an include.
> It would be better if people didn't see the php extension as in:
> www.rokpacardiff.com

afair its handled by enabling the MultiViews option, apache then
searches for an appropriate extension file to serve if an exact match
doesnt exist.
nb: this mechanism is also used to provide pages in multiple languages
by automatically selecting one with the right language name extension.

for neil's question:
another approach, if your trying not to break existing urls, is to
remove the directory concerned, and replace it with a php script of the
same name, so that the php script gets executed in place of that entire
directory.

eg. we replace the directory 'stuff' with a script 'stuff.php' 
   http://myhost/stuff/file.html

MultiViews will allow the system to see the file stuff.php inplace of
just stuff, that script will then be executed in the normal way, and the
rest of the path will be given as a PATH_INFO parameter to it.
so in this case $_SERVER[PATH_INFO] will contain "/file.html"

this way you can create whole virtual heirarchies of file structure that
are handled by a single script, your script can then decide what content
should have been output.




More information about the Swlug mailing list