Re: How does work shorten url services?
| From: | Peter Brodersen | Date: | Sun, 19 Sep 2004 13:41:22 +0000 |
| Subject: | Re: How does work shorten url services? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197180@lists.php.net to get a copy of this message | ||
On Sat, 18 Sep 2004 22:33:09 +0800, in php.general
php-general@gremlins.biz (Jason Wong) wrote:
>> Ok, it is like I thought, but if it is made in PHP is
>> there a way to catch all the ID sent to the main page
>> of tinyurl.com and then query the database?
>
>If your webserver is apache you could use its rewrite engine to ensure that
>all requests to http://example.com/ gets processed by php (see
>apache docs).
Further: Apache-solution
One of the simplest methods (if the user is able to change the
configuration of the server config or virtual host) is to point
DocumentRoot to a file and not a directory. E.g.
DocumentRoot /path/to/handler.php
At least the apache following with debian stable will issue a warning
(which could be ignored) that the directory-path does not exist. I
suppose it only checks for the existance of a directory with that
name.
Another dirty method include using a 404-document for handling
requests to files that do not exist:
ErrorDocument 404 /404handler.php
(one could still set a 200 OK-returncode)
.. but all this is out of PHP-scope.
--
- Peter Brodersen