PDA

View Full Version : How to remove the .php from a PHP script?


trevHCS
13-12-2002, 05:29 PM
Second PHP question of the day - is it possible on Flump to call a PHP script as:

thisurl.com/some_php_script?x=1 ?

ie: Remove the .php extension, but still have it parse as a PHP script?


I've seen it done on a few sites, but can't work out how its done. Or is this something that I need to provide huge amounts of alcoholic beverages to the guys & gals at Flump to do for me?


I'm not actually sure if my grand plan will work in the end anyway, but hopefully it will...

Cheers
Trev
--
http://www.aardvarktravel.net

Andy
13-12-2002, 06:42 PM
Again I bet you could achieve this using mod_rewite, however you might be better off using a contenttype messagine in a .htaccess file to define how all files (regardless of extension) in the current directory are processed by Apache.

Again, sorry, something to Google for!

Andy

trevHCS
13-12-2002, 07:25 PM
Andy, your a genius - hadn't thought about .htaccess! :)

If anyone else if wondering, the solution seems to be based around:

DefaultType application/x-httpd-php

Just add that to a text file called .htaccess, upload it to the directory where you want any files without extensions to be parsed as PHP and away you go... (must be uploaded as ASCII)

Note - all subdirectories under this directory are also affected and you might want to check theres not already a .htaccess file in place, in which case to download that > edit > upload

http://engr.oregonstate.edu/computing/tutorials/htaccess/config.html

Trev - off to find out about mod_rewrite now