Re: Creating User Friendly URLS

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

 



As a general rule, if you want to see everything useful that is
available to you in your script:

http://php.net/phpinfo

In particular, this will show you the PATH_INFO if it's there, and the
REQUEST_URI if that's there, and...

If neither of those are available, I don't think you'll be able to do
what you want...

It could just be a server configuration issue.

PHP doesn't really "decide" what to put in $_SERVER.

Your web server puts a bunch of stuff in the environment SERVER
variable, and PHP just passes the buck on to you to do something
useful with it.

Or so I understand it.

On Thu, August 17, 2006 9:43 am, Dave M G wrote:
> 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
>
>


-- 
Like Music?
http://l-i-e.com/artists.htm

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