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/)
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/)