PHP/SQL static URLs giving dynamic content
Date: 10/19/05
(MySQL Communtiy) Keywords: php, database, web
howdy...
i have a fun one for you. i've written a user-driven database web-programthat uses PHP to create pages on the fly according to variables that draw information from the database. as it stands now, none of the "profile" pages actually exists, they are created via GET method - http://thepage.com/page.php?email=bob@thepage.com
now, what i'd like to do is offer my users the ability to use a static URL for example http://thepage.com/bob instead of http://thepage.com/page.php?email=bob@thepage.com. the first method i tried goes as follows.
i altered the htaccess to redirect all 404 requests to a file containing a script that pulled the last part of the URL "/bob" and used it as a variable to send as GET, thus creating the page. the reason i did this, theoretically it would handle ALL variations of http://thepage.com/bob that anyone could dream up and rely on the database to fill in the blanks. however, i was unable to make this work. i was able to complete the redirect portion by using a fixed redirect URL but i was unable to pull a GET variable from the URL and have it sent to the newly constructed page.
any and all suggestions are very welcome, especially if i am simply wrongheaded in my approach and there is a better, more efficient way to accomplish the same goal. thank you all for yout time and advice. take care.
Source: http://www.livejournal.com/community/mysql/71027.html