Chugalug Linux Users Group- Apache content negotiation and PHP
CHUGALUG
Chattanooga
Unix Gnu
and Linux
User Group
Recent Keywords:
From: "Robert A. Kelly III" ------------------------------------------------------ I am working with Apache on a Debian server (not mine, so I don't have access to the main config) and I'm having problems with content negotiation working. Here is the problem: I have files named {foo}.php I use links to {foo} so that if I ever change and use a different technology on the backend, say Perl or Python, and {foo}.php become {foo}.pl or {foo}.py the links should still work. When a visitor requests {foo}, either by clicking a link or typing {foo} into the address bar, the server should search for {foo}.php, {foo}.pl, {foo}.py, etc, and serve whatever it finds. However, when a visitor requests {foo}, and {foo}.php exists (but not {foo} or {foo}.html) the visitor gets a 404 error instead. If {foo}.html exists, this will be served, but not {foo}.php One suggestion was to use mod

=============================================================== From: Mike Harrison ------------------------------------------------------ I'll refer you to our very own http://www.chugalug.org http://www.chugalug.org/widget/428/Apache%20content%20negotiation%20and%20PHP Specifically. "widget" is merely a symbolic link to "index.php" ln -s index.php widget In the website directory. No "mod-rewrite" or any other special server side configs needed. That server is runnig EHCP (Easy Hosting Control Panel) and the website vhosts are not easily tunable, they are "EHCP defaults" which have been working well so far for generic web hosting.

=============================================================== From: "Robert A. Kelly III" ------------------------------------------------------ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 That is interesting. If I do: ln -s foo.php foo Then links to /foo return the contents of foo.php without preprocessing it through php. Now, I could use ForceType to process all files without extensions (or with unknown extensions) to treated as php files, but I am not sure this is a good idea. Now what about the part after "widget"? /428/Apache%20content%20negotiation%20and%20PHP looks like a directory structure, I would have thought you would need mod

=============================================================== From: Mike Harrison ------------------------------------------------------ Ok.. I just checked.. In my apache2/mods-enabled/php5.conf I had added: SetHandler application/x-httpd-php SetHandler application/x-httpd-php and forgotten about it. You might be able to do that via .htaccess as: AddHandler php-script .foo or: SetHandler php-script To do all of them. I google those, they might not be applicable.

=============================================================== From: Mike Harrison ------------------------------------------------------