[nycphp-talk] Many pages: one script

Hans Zaunere lists at
Tue Aug 14 15:08:24 EDT 2007

Rob Marscher wrote on Monday, August 06, 2007 10:50 AM:
> On Aug 5, 2007, at 2:42 PM, Hans Zaunere wrote:
> > AliasMatch /(.*) "/var/www/"
> I wonder why the major php frameworks don't mention this as an
> option?  It seems from the documentation that it can't go
> in .htaccess - so that may be why.  The frameworks are assuming most
> of their users are on shared servers and can't modify their httpd
> config.

Yeah, that's probably why.  We only ever work in large deployments, which of
course have dedicated servers.  .htaccess is thus evil, and slower.  Neither
clients nor I ever intend to support for
our applications.

> If there was an existing file... say favicon.ico... would AliasMatch
> know to just serve that up instead of sending through index.php?

Yes - Apache is already aware of the extensions of files for which to
process through PHP.  The /support/ alias in my example is really just for
convenience and to keep developers in line.  Apache already knows how to
serve files correctly because of AddType (or even ForceType) and their
extension.  Thus, a .php file will trigger the auto_prepend to fire, and
startup the application framework.

> That's one thing I like about the following mod_rewrite rule - if the
> file or directory exists, it won't pass it to the index.php front
> controller:
> RewriteCond %{SCRIPT_FILENAME} !-f
> RewriteCond %{SCRIPT_FILENAME} !-d
> RewriteRule ^(.*)$ index.php/$1

So using a rewrite rule is redundant, and a hack in my opinion.  This is the
fundamental difference between rewriting and aliasing.

Hans Zaunere / President / New York PHP  /

More information about the talk mailing list