intercepting URLs in a "control-system"

This is a discussion on intercepting URLs in a "control-system" within the PHP General forums, part of the PHP Programming Forums category; Please forgive any obvious ignorances on my part, I am just learning PHP... Having read quite a bit on-line, ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-16-2003
Alan Lord
 
Posts: n/a
Default intercepting URLs in a "control-system"

Please forgive any obvious ignorances on my part, I am just learning PHP...

Having read quite a bit on-line, I am interested in trying to "trap" URLs
sent to my site so I can process the request and respond without
neccessarily having a "real" page to serve. If this makes any sense, how do
I do it? Because I expect that apache (in my case) would not like a URL that
contains extra directories/files and would reject it.

An example:

Web Site Root:

www.abc.com/index.php

On that page are "a" tags to further information but which physically don't
exist. It will be automatically generated from a database. For example:

www.abc.com/cars/volvo/X70.html

If I don't have that directory tree and a file called X70.html. Could I
"trap" the http/URL request (BEFORE apache throws it out) and process it in
my PHP control-engine which will find the right information and respond
accordingly?

Thanks in advance,

Alan

PS, if there are any examples of this (GPL) which you know of, please just
pass me the link.
Reply With Quote
  #2 (permalink)  
Old 10-16-2003
Ray Hunter
 
Posts: n/a
Default Re: [PHP] intercepting URLs in a "control-system"


> Having read quite a bit on-line, I am interested in trying to "trap" URLs
> sent to my site so I can process the request and respond without
> neccessarily having a "real" page to serve. If this makes any sense, how do
> I do it? Because I expect that apache (in my case) would not like a URL that
> contains extra directories/files and would reject it.


Try looking at apache mod_rewrite and see if that will work for you...i
have used it to do url rewrites for me and have a main php page handle
the requests.

--
BigDog
Reply With Quote
  #3 (permalink)  
Old 10-16-2003
Marek Kilimajer
 
Posts: n/a
Default Re: [PHP] intercepting URLs in a "control-system"

Another option besides mod_rewrite is ErrorDocument directive in .htaccess:

ErrorDocument 404 404.php

In 404.php you trap the request, url will be in $_SERVER['REQUEST_URI']

Alan Lord wrote:
> Please forgive any obvious ignorances on my part, I am just learning PHP...
>
> Having read quite a bit on-line, I am interested in trying to "trap" URLs
> sent to my site so I can process the request and respond without
> neccessarily having a "real" page to serve. If this makes any sense, how do
> I do it? Because I expect that apache (in my case) would not like a URL that
> contains extra directories/files and would reject it.
>
> An example:
>
> Web Site Root:
>
> www.abc.com/index.php
>
> On that page are "a" tags to further information but which physically don't
> exist. It will be automatically generated from a database. For example:
>
> www.abc.com/cars/volvo/X70.html
>
> If I don't have that directory tree and a file called X70.html. Could I
> "trap" the http/URL request (BEFORE apache throws it out) and process it in
> my PHP control-engine which will find the right information and respond
> accordingly?
>
> Thanks in advance,
>
> Alan
>
> PS, if there are any examples of this (GPL) which you know of, please just
> pass me the link.
>

Reply With Quote
  #4 (permalink)  
Old 10-17-2003
Cristian Lavaque
 
Posts: n/a
Default Re: intercepting URLs in a "control-system"


http://www.sitepoint.com/article/485

That could have the answer you're looking for.



Alan Lord wrote:
> Please forgive any obvious ignorances on my part, I am just learning
> PHP...
>
> Having read quite a bit on-line, I am interested in trying to "trap"
> URLs sent to my site so I can process the request and respond without
> neccessarily having a "real" page to serve. If this makes any sense,
> how do I do it? Because I expect that apache (in my case) would not
> like a URL that contains extra directories/files and would reject it.
>
> An example:
>
> Web Site Root:
>
> www.abc.com/index.php
>
> On that page are "a" tags to further information but which physically
> don't exist. It will be automatically generated from a database. For
> example:
>
> www.abc.com/cars/volvo/X70.html
>
> If I don't have that directory tree and a file called X70.html. Could
> I "trap" the http/URL request (BEFORE apache throws it out) and
> process it in my PHP control-engine which will find the right
> information and respond accordingly?
>
> Thanks in advance,
>
> Alan
>
> PS, if there are any examples of this (GPL) which you know of, please
> just pass me the link.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:21 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0