logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Apache2 forces me 2 specify 'php' file extensions
Author
elwoody



Joined: 05 Oct 2006
Posts: 5
Location: SFCA

PostPosted: Thu 05 Oct '06 6:35    Post subject: Apache2 forces me 2 specify 'php' file extensions Reply with quote

Friends,

I gotz:
Apache 2.0.59
Php 5.1.6
WXPP-SP2

Thanks in advance for your help - this is killing me, yet I'm certian it's simple.

I just upgraded from Apache 1.3, and now I must add '.php' to all my urls - otherwise I get 404's.


This works:
http://localhost/phpinfo.php


This doesn't - though it did with 1.3:
http://localhost/phpinfo


How do I register a file alias? Or, if that's not what it is, how might I fix this?
Back to top
markymark



Joined: 26 Aug 2006
Posts: 10
Location: Brighton, UK

PostPosted: Thu 05 Oct '06 9:34    Post subject: Reply with quote

I'm no expert on this but it looks like you're going to need to do content negotiation using mod_negotiation.

There's a good bit of information at

http://www.websiteoptimization.com/speed/tweak/rewrite/

Hope that helps.

Mark
Back to top
markymark



Joined: 26 Aug 2006
Posts: 10
Location: Brighton, UK

PostPosted: Thu 05 Oct '06 9:41    Post subject: Reply with quote

There seems to be another way to do this. Try adding:

ForceType application/x-httpd-php

to your .htaccess file.

Mark
Back to top
Brian



Joined: 21 Oct 2005
Posts: 209
Location: Puyallup, WA USA

PostPosted: Fri 06 Oct '06 2:07    Post subject: Reply with quote

phpinfo.php is a file that you are requesting. The server is simply assuming that just phpinfo is a directory. When you add the extension it knows that it needs to handle the file in a certain way. If you don't add the extension then it must be FORCED to assume that this is a PHP file, in which case what would happen if you had a file called PHPINFO.PHP and a directory called PHPINFO and you just called http://localhost/phpinfo? Would it go to the directory or open the PHP file?

Sounds confusing to me.

Are you saying that this would go to phpinfo.php on your 1.3 server?

I have never used 1.3 version, but I cannot imagine that would be the case. That means the server is being instructed to add the .php or perhaps phpinfo.php is one of the defined default pages, or mod_rewrite is completing the url, sheeesh, I just don't know.

I'd say that you need to simply include the .php, why not after all is my question Smile
Back to top
CanUuRead



Joined: 18 Sep 2006
Posts: 38

PostPosted: Fri 06 Oct '06 19:23    Post subject: Reply with quote

Elwoody,

What you want can be achieved by adding MultiViews in the directory that contains the files.

Example:

<Directory "X:/somefolder">
Options MultiViews
...
...
...
</Directory>

Note the following documentation:
http://httpd.apache.org/docs/2.0/mod/core.html#options

http://httpd.apache.org/docs/2.0/content-negotiation.html#negotiation - SCROLL DOWN TO MULTIVIEWS SECTION

Before you USE THIS, MAKE SURE YOU READ THE ABOVE documentation so you understand the behavior.

Note: Mod_Negotiation must also be enabled via the LoadModule directive
Back to top


Reply to topic   Topic: Apache2 forces me 2 specify 'php' file extensions View previous topic :: View next topic
Post new topic   Forum Index -> Other Software