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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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. | |
|
|||
|
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! |
|
|||
|
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 |
|
|||
|
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/ |