Re: create htaccess.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Adwinwijaya <adwinwijaya@xxxxxxxxxxxx>:
> 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@xxxxxxxxxx
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux