View Single Post
  #4 (permalink)  
Old 02-14-2008, 06:41 PM
fbnewtz fbnewtz is offline
WebProWorld New Member
 
Join Date: Apr 2006
Location: Houston, TX
Posts: 13
fbnewtz RepRank 1
Default Re: html file w/ no file extension

It is actually pretty easy. We do it as well. Makes for nice clean URL's.

The problem with giving examples is there are different requirements for different versions of apache.

But you will basically want to create a PHP file that will pull information from your database. From there you will want to save the file without a file name. For example:

test.php would be saved as just test.

From there you would put a set of lines like this in your .htaccess file or in your httpd.conf file if you had access to that:

<Files test>
ForceType application/x-httpd-php
</Files>

Now your test file would need to parse the URL properly and then use the extra "directories" to pass as parameters to the query or whatever else you wanted to do. Such as this:

www.test.com/test/var1/var2/var3

$chunk = explode("/", $_SERVER['PATH_INFO']);

Then you can reference each different variable as:

$chunk[1] = var1
$chunk[2] = var2
$chunk[3] = var3

etc..

From there just use that information as parameters in your Query so you pull the right data from your database.


It is pretty easy and there is a tiny bit of information on the web relating to this, but it is out there.

Good luck,

Fred
Reply With Quote