Re: Redirecting to PHP script

From: Date: Wed, 21 Jun 2000 14:25:31 +0000
Subject: Re: Redirecting to PHP script
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2494@lists.php.net to get a copy of this message
Hello Nick, You can do this using <Location>, <Directory> or <File> directives. Go to www.phpbuilder.com and check out Rasmus' article on Spell Checking and URL Tricks. HTH, Zak At 11:27 AM 6/21/00 +0100, Nick Talbott wrote:
Hello, new list! I wonder if anyone has a suggestion to how I might make the following work (better than the way I am currently doing it). Sorry, this is going to take a bit of explaining :-) What I am doing is this: (PHP as Apache module on Linux) Someone accesses a site using a url like www.mysite.org/john Now the resource (file or directory) "john" will not exist. What I want to do is to remap that url to a php script that does a database lookup on "john" and generates the site from a template. What I have got working is this: In the Apache configuration file I have a directive for the (virtual) site that redirects the 404 error (file not found) to a php script. ErrorDocument 404 /start.php This works fine. In the start.php script I check the $REDIRECT_URL and pull out the requested directory and handle it accordingly. However, because we are working on the basis of URL errors, my web server error log will get loaded up with "file not found" errors. It also means that "genuine" file not found problems are going to get handled wrongly. What I would like to do: I have played around with the AliasMatch directive, trying to do something like .. AliasMatch ^/(.*) /usr/local/apache/start.php?site=$1 .. but Apache complains this is invalid syntax. It will work if I just say .. AliasMatch ^/(.*) /usr/local/apache/start.php .. but then I don't get the variable passed. Thanks for reading so far! Anyone any ideas on an elegant approach? Is this one that mod_rewrite could handle? Nick Talbott IT Policy and Strategy Manager, Powys County Council, UK email nickt@powys.gov.uk FAX +44 (0) 1597 824781 web http://www.powys.gov.uk and http://www.powysweb.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
Zak Greant Creative Director Nucleus Information Service Inc. "A camel is a horse designed by a committee." - Alex Issigonis (Designer of the Morris Mini)

« previous php.general (#2494) next »