PDA

View Full Version : Serve Extentionless PHP


edified
11-04-2006, 08:03 AM
I'd like to serve PHP but without the .php extension so that http://brockhuman.com/music.php becomes http://brockhuman.com/music

I'm guessing I could do this with an URL rewriter but the goal is to serve all extentionless files as PHP. Is there a way to instruct the server to serve all extentionless files as PHP? In apache I've used .htaccess (req's mod_rewrite) to assign null extentions to a php handler like this:

[quote]
<FilesMatch'^[^.]*$'>
SetHandlerphp-cgi
ForceTypetext/html
</FilesMatch>
</CODE>

My preferred method is actually using apache MultiViews via .htaccess, which is simply:
[quote]Options+MultiViews</CODE>
And then using qs to prefer file types.

Multiviews is best because then I can just call also images without an extension in my rendered XHTML so I never have to modify code when I change image type (eg from gif to png or jpg to gif etc...) Additionally I can set a qs preference to serve php first which allows me to serve extentionless PHP, just like I like it!

That said I have just about no experience on IIS. Does it have a multiviews equivalent? What about handler settings for extensionless files? Perhaps you know a better way to do this on a Windows server?

Thank you for your expertise, Ed

edified.org (http://edified.org/)

bruce
11-06-2006, 07:31 AM
I don't think you can do this in IIS.


Bruce

DiscountASP.NET
www.DiscountASP.NET (http://www.DiscountASP.NET)

edified
11-08-2006, 07:57 AM
Dang.

Well if anyone can think of an apache comparable solution please post, I'm new to all this.

Cheers, Ed

edified.org (http://edified.org/)