Creating User Friendly URLS

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

 



PHP List,

My goal is to create user and search engine friendly URLs like:
mysite.com/my_web_page_title

Instead of:
mysite.com/index.php?pageID=1

I asked about this before:
http://marc.theaimsgroup.com/?l=php-general&m=113597988027012&w=2

And there is this helpful tutorial:
http://agachi.name/weblog/archives/2005/01/30/rewriting-dynamic-urls-into-friendly-urls.htm

Both of which refer to a variable called $_SERVER['PATH_INFO'].

But, in the php.net manual, in the predefined variables page, 'PATH_INFO' is only obliquely referenced in the $_SERVER variable description, under the 'PATH_TRANSLATED' element.

When I've tried echoing out the contents of $_SERVER['PATH_INFO'], I get nothing.

I'm trying to set it so that pages are named according to their title in my MySQL database. So my script will pull "my_web_page_title" out of the URL, match that against the database, and then display the appropriate contents.

I thought I could do this by simply making my link into:
<a href="index.php/my_web_page_title">My Web Page Title</a>

And then stripping out the "index.php", and using the remainder for both the URL and the database lookup.

But, while I'm sure there are more steps than that, I'm halted initially because I'm not sure where in the $_SERVER array my URL is being stored.

Any advice on how to proceed here would be greatly appreciated. Thank you.

--
Dave M G

--
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