URL Capture Challenge

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
brianpauljaus
Forum Newbie
Posts: 1
Joined: Fri Feb 19, 2010 9:51 pm

URL Capture Challenge

Post by brianpauljaus »

I am not sure if this is possible, but it seems like it should be. I have a simple root directory for a website. The only thing I want in this directory is the index / controller file.

Users will access our site with custom URLs... i.e.

http://www.domain.com/bob
http://www.domain.com/sally

I wish the controller the capture the URL and then place the string after the slash, such as "bob" and "sally" in the example above. Simple enough right ? No.


This must scale to hundreds or thousands of custom URLs. When I do this it seems to want to look for a controller or file named "bob" or "sally" and the page errors out. That is to say that it is not even reaching the index.php file to run the code to capture the URL because it is erroring out trying to find a file named "bob" or "sally".

Any suggestions ? How do I have one single controller / index.php file and have custom URLs. The custom URLs do nothing more than alert us what sales rep referred them and outside of that do nothing else and do not refer to any files or folders. Seems simple enough but I dont know the answer. Much obliged for any help someone can provide.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: URL Capture Challenge

Post by Eran »

Post Reply