You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by JBT <ju...@gmail.com> on 2005/01/10 22:41:57 UTC

[users@httpd] Rewrite for extensionless names (without .htm* .php), how?

In Apache 1.* I used to have:
http://domain.com/somefile (in browser bar)
automatically load
http://domain.com/somefile.html
or
http://domain.com/somefile.htm
or
http://domain.com/somefile.php

( Of course only when there would be no
http://domain.com/somefile/ folder residing on the server..)

So, the file-extension got loaded/spotted or guessed by Apache.

Could someone point me in the right direction
of how to accomplish that with Apache 2.0 ?
I guessed it's something with mod_rewrite and the file\.. (the . for any file)
regular expressions, but isn't this option built in the core somewhere?
I don't remember how I'd done that in the old Apache, it's been so long...

Couldn't find it anywhere. I'd say many would love to know and use this!

Also; How much extra load is this on a server when such is active?

Thanks for any info.

-- 
Adios

Julius
http://jult.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite for extensionless names (without .htm* .php), how?

Posted by Leif W <wa...@usa.net>.
> Rich Bowen; 2005 January 10 Monday 17:07
>
> JBT wrote:
> | In Apache 1.* I used to have:
> | http://domain.com/somefile (in browser bar)
> | automatically load
> | http://domain.com/somefile.html
> | or
> | http://domain.com/somefile.htm
> | or
> | http://domain.com/somefile.php
> |
> | ( Of course only when there would be no
> | http://domain.com/somefile/ folder residing on the server..)
> |
> | So, the file-extension got loaded/spotted or guessed by Apache.
> |
> | Could someone point me in the right direction
> | of how to accomplish that with Apache 2.0 ?
> | I guessed it's something with mod_rewrite and the file\.. (the . for
> any file)
> | regular expressions, but isn't this option built in the core 
> somewhere?
> | I don't remember how I'd done that in the old Apache, it's been so 
> long...
>
> It's called "Content Negotiation" and is provided by mod_negotiation.
> Options +Multiviews
> turns it on
>
> | Couldn't find it anywhere. I'd say many would love to know and use 
> this!
> |
> | Also; How much extra load is this on a server when such is active?
>
> It's a pretty significant performance hit, but I can't really say what
> percentage. Try some simple benchmarking with something like ab.

mod_rewrite could be made to work, but it'd probably be the most 
expensive, and perhaps doesn't negotiate.

mod_negotiation will do negotiation and there are two options:
1) Options +MultiViews can be expensive because it uses implicit match 
of filename and places more work at request time.
2) type-map handler which is more efficient because it uses explicity 
defined behaviors and places more work on you.

http://httpd.apache.org/docs-2.0/content-negotiation.html#negotiation

You can see type-maps in action in the default /error/ directory 
configuration and the corresponding .var files in your .../error/ 
directory.

Leif



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Rewrite for extensionless names (without .htm* .php), how?

Posted by Rich Bowen <rb...@rcbowen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

JBT wrote:
| In Apache 1.* I used to have:
| http://domain.com/somefile (in browser bar)
| automatically load
| http://domain.com/somefile.html
| or
| http://domain.com/somefile.htm
| or
| http://domain.com/somefile.php
|
| ( Of course only when there would be no
| http://domain.com/somefile/ folder residing on the server..)
|
| So, the file-extension got loaded/spotted or guessed by Apache.
|
| Could someone point me in the right direction
| of how to accomplish that with Apache 2.0 ?
| I guessed it's something with mod_rewrite and the file\.. (the . for
any file)
| regular expressions, but isn't this option built in the core somewhere?
| I don't remember how I'd done that in the old Apache, it's been so long...

It's called "Content Negotiation" and is provided by mod_negotiation.
Options +Multiviews
turns it on

| Couldn't find it anywhere. I'd say many would love to know and use this!
|
| Also; How much extra load is this on a server when such is active?

It's a pretty significant performance hit, but I can't really say what
percentage. Try some simple benchmarking with something like ab.

- --
Rich Bowen - rbowen@RCBowen.com
Apache Administrators Handbook - http://apacheadmin.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB4vyaXP03+sx4yJMRAgoDAJ4+/lePx9wwlqsSLlwNRrIYHoKZ5gCg3o7h
aWRnlkcbOH20UjhpMIv0+J0=
=LmIq
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org