Re: create htaccess.
| From: | Matthew Weier O'Phinney | Date: | Mon, 06 Dec 2004 00:33:28 +0000 |
| Subject: | Re: create htaccess. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-203546@lists.php.net to get a copy of this message | ||
* Adwinwijaya <adwinwijaya@yahoo.com.au>:
> I have a question about htaccess (I cannot modify httpd.conf in the
> server since I just host on server, not dedicated one.
>
> I want to be able to convert from :
>
> www.mysite.com/index.php?f=module_a.php
>
> into
>
> www.mysite.com/index/module_a.php
In you .htaccess:
<File index>
ForceType application/x-httpd-php
</File>
DirectoryIndex index
Then, in your script, you'll need to access the PATH_INFO environment
variable via the $_SERVER array to parse out the argument(s):
$pi = $_SERVER['PATH_INFO']; // Grab PATH_INFO
$pi = substr($pi, 1); // Remove the opening slash
$args = split('/', $pi); // Create array of arguments
$f = $args[0]; // Grab first argument
--
Matthew Weier O'Phinney | mailto:matthew@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org