Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PHP with no file extension

0 views
Skip to first unread message

Benjamin

unread,
Sep 29, 2006, 5:39:10 PM9/29/06
to
Hi, I'm running PHP as an Apache module. I've always wondered how you
set Apache up to parse a file as PHP without a file extension. Do you
use the AddType directive?

Andy Hassall

unread,
Sep 29, 2006, 5:57:46 PM9/29/06
to

Some possibilities:

MultiViews - Apache picks an appropriate file based on the start of the
filename. You can have other types of files, e.g. images, in the same
directories, although there's some overhead to the way Apache picks files.

ForceType - force all files in a directory to be run as PHP. Pretty simple,
but don't put any other files in the same directory.

RewriteRule - mod_rewrite can do all sorts of transformations from URLs to
files, adding a .php extension would be a trivial rule.

The alt.apache.configuration group should be able to give more detail.

--
Andy Hassall :: an...@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

Jens Müller

unread,
Sep 30, 2006, 3:42:37 AM9/30/06
to
> RewriteRule - mod_rewrite can do all sorts of transformations from
> URLs to files, adding a .php extension would be a trivial rule.

Question:
Is this slowing down website access and how much?

Thanks,
Jens

Jerry Stuckle

unread,
Sep 30, 2006, 11:18:03 AM9/30/06
to

Not significantly, unless you have a very busy site and complex rules.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

mat...@gmail.com

unread,
Sep 30, 2006, 6:55:22 PM9/30/06
to
If you want to have other file extentions treated as PHP, you can
simply use this line, as you suggested:

AddType php-cgi .html .htm .xml

For this example, html, htm, and xml files are treated as PHP.

0 new messages