How do I make Apache make php = no extension?

This is a discussion on How do I make Apache make php = no extension? within the Apache Web Server forums, part of the Web Server and Related Forums category; Hello, I've just converted from Windows 2000 Professional as my webserver, to Debian. I'm using Apache 2 with ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2004
Morten Skyt
 
Posts: n/a
Default How do I make Apache make php = no extension?

Hello,

I've just converted from Windows 2000 Professional as my webserver, to
Debian. I'm using Apache 2 with PHP and a lot of other extensions.

But I've run into a "tiny" problem:

How do I make .php = no extension?

Let me put up a scenario:
I've uploaded the file test-file.php to /.
When I go to http://web-server/test-file.php it should be displayed
(obviously), but I ALSO want it to be displayed when I go to
http://web-server/test-file (without the extension!)

You can say that http://web-server/test-file.php =
http://web-server/test-file

.... but how?


I have seen this on my windows-testserver, when using the pre-compiled
pre-configured xampp package from www.apachefriends.org, so I know
it's possible...

I've coded a lot of pages this way (though it's a baad way, but it
looks prettier to me ;), so I'd rather make it work again, hehe.


Thanks a lot in advance!
/Morten Skyt
  #2 (permalink)  
Old 01-12-2004
Davide Bianchi
 
Posts: n/a
Default Re: How do I make Apache make php = no extension?

Morten Skyt <skyt@klasen.dk> wrote:
> (obviously), but I ALSO want it to be displayed when I go to
> http://web-server/test-file (without the extension!)


I think that this is a really bad idea. This way it's impossible to
distinguish between directories and files and Apache will take twice
as much to do his job. Anyway, you could do that using mod_rewrite.

Why do you want such thing?

Davide

--
| Q: How many Bill Gateses does it take to change a light bulb? A: One.
| He puts the bulb in and lets the world revolve around him. A: None. He
| declares Darkness(tm) the new industry standard.
|
  #3 (permalink)  
Old 01-13-2004
Morten Skyt
 
Posts: n/a
Default Re: How do I make Apache make php = no extension?

Davide Bianchi <davideyeahsure@onlyforfun.net> wrote in message news:<bturt9$bhslp$6@ID-18487.news.uni-berlin.de>...
> Morten Skyt <skyt@klasen.dk> wrote:
> > (obviously), but I ALSO want it to be displayed when I go to
> > http://web-server/test-file (without the extension!)

>
> I think that this is a really bad idea. This way it's impossible to
> distinguish between directories and files and Apache will take twice
> as much to do his job. Anyway, you could do that using mod_rewrite.
>
> Why do you want such thing?
>
> Davide


Thank you very much, I'll look into it.

The reason for wanting to do something like this, is simply because it
looks prettier. You know, it's easier for people to remember a url
like server.com/christmas instead of server.com/christmas.php - people
will simply forget. I have thought of just making directories with
index-files redirecting them to the real url, but I think that'd be
even worse coding than my remove-extension-thingie.

Again, thanks for the quick answer!
  #4 (permalink)  
Old 01-13-2004
Davide Bianchi
 
Posts: n/a
Default Re: How do I make Apache make php = no extension?

Morten Skyt <skyt@klasen.dk> wrote:
> You know, it's easier for people to remember a url
> like server.com/christmas instead of server.com/christmas.php


Use index.php instead and add the index.php to the DirectoryIndex
option. So it becomes server.com and nothing more.

Davide

--
| The Weak Lusethropic Principle states: "As more idiot-proof software
| becomes avalable, more idiots are able to use computers. Idiot-proof
| software did not make or cause computer lusers; it simple allowed
| lusers to use computers where they could not before." --Ben Cantrick
  #5 (permalink)  
Old 02-13-2004
Mark Tranchant
 
Posts: n/a
Default Re: How do I make Apache make php = no extension?

Davide Bianchi wrote:
> Morten Skyt <skyt@klasen.dk> wrote:
>
>>You know, it's easier for people to remember a url
>>like server.com/christmas instead of server.com/christmas.php

>
>
> Use index.php instead and add the index.php to the DirectoryIndex
> option. So it becomes server.com and nothing more.


Use MultiViews in your Options line. This is a little more
processor-intensive, but frees you from extensions completely, even in the
site code. See my site (sig) as an example.

--
Mark.
http://tranchant.plus.com/
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:10 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0