[PHP] Re: hide php extension...

2004-03-24 Thread Geir Pedersen - Activio AS

Hi, John!

There is an easy way to achieve what you are looking for without modifying
webserver configuration files.

Say you want to support an URL like http://www.example.com/search?foo=bar

Create a new subdirectory named search and place a default PHP script
named index.php in the new directory. The script will get called whenever
the URL above is read.

--

Geir Pedersen
http://www.activio.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: hide php extension...

2004-03-24 Thread john doe
if there's other options, please let me know...

thank you
Geir Pedersen - Activio As [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

 Hi, John!

 There is an easy way to achieve what you are looking for without modifying
 webserver configuration files.

 Say you want to support an URL like http://www.example.com/search?foo=bar

 Create a new subdirectory named search and place a default PHP script
 named index.php in the new directory. The script will get called whenever
 the URL above is read.

 --

 Geir Pedersen
 http://www.activio.com/ 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: hide php extension...

2004-03-24 Thread Justin French
On Thursday, March 25, 2004, at 04:37  PM, john doe wrote:

if there's other options, please let me know...
At some level, you have to make a change *somewhere* :)

If not through script naming and placement, then through web server 
configuration.  However, most of these configurations for Apache can be 
done through a .htaccess file in your web root, assuming your host 
allows them -- most do.

1. Options +MultiViews

MultiViews will ask Apache to look for the requested resource eg 
/foo/bah/boo/, and if not available, it will step backwards down the 
path until it finds something.  It also ignores extensions  (forgive my 
crude / quick description). So,

foo.php/?id=2 and foo/?id=2 are the same resource

There's downside, which is that requesting foo/bah/boo may result in 
foo.php being called (which is great), but if foo/bah/boo was never 
intended to exist, Apache will not generate a 404 error -- it will 
leave it upto foo.php to decide what to do.

2. mod_rewrite

You could use mod_rewrite to rewrite your URLs so that foo/?id=2 is 
internally rewritten to foo.php?id=2

3. Forcing type

You could name your script just 'foo' instead of 'foo.php', and force 
'foo' to be parsed through PHP:

Files foo
ForceType application/x-httpd-php
/Files
Similarly, if you were worried about anyone knowing you were running 
PHP, or having your URLs tied to PHP permantently, you could force all 
.html files through PHP.

Files ~ \.html$
ForceType application/x-httpd-php
/Files
There's plenty Apache can do to solve your problem -- if your host 
doesn't allow it, move hosts... there's only two ways out of this that 
I'm aware of:

1. change apache
2. severely rework your file structure (as discussed already)
---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php