Re: mod_rewrite
| From: | Philip Hallstrom | Date: | Mon, 22 Apr 2002 18:08:38 +0000 |
| Subject: | Re: mod_rewrite | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94040@lists.php.net to get a copy of this message | ||
You could also do something like this:
Configure Apache so that *every* request on a virtual
host would be handled by a single PHP script.
<VirtualHost *:80>
ServerName myserver.mydomain.org
DocumentRoot /usr/local/www/myserver
Action php-parse /path-to/script.php
Action php-parse /path-to/script.php
SetHandler php-parse
<Location "/path-to/script.php">
SetHandler "application/x-httpd-php"
</Location>
</VirtualHost>
Every request (whether the file exists or not) is handled by
/path-to/script.php.
Note that this means that gifs/jpgs also get run through this...
On Wed, 17 Apr 2002, [ rswfire ] wrote:
> I could really use your help with this. The examples I have received from
> everyone thus far have not worked, including the last one that you posted.
> This is the situation:
>
> I have multiple domains, each with multiple subdomains, all of which
> automatically point to the root of my web environment. I have only one file
> that does all of the work for all of these websites/webpages, and that is
> the index.php file in the root. This file is smart enough to parse the url
> being accessed and create an appropriate page based on a very complex set of
> rules.
>
> Originally, I was using the ErrorDocument 404 to make it access the
> index.php file, but this has some inherent flaws. The biggest problem was
> that forms that were being posted to a page that doesn't really exist never
> maintained the posted variables (due to the 404 redirect.) Another
> limitation was that it just created a bunch of unnecessary error messages in
> my error log since there are no "real pages" on my network, even though it
> pretends there is.
>
> So, I need to use mod_rewrite. That is apparent now. The problem is I know
> nothing about creating regular expressions. I simply need it to rewrite the
> url for any file that does not exist (it should not try to do so for a file
> that really does exist, say an image file) and it needs to have the
> following rule:
>
> A*.B*.C*/D*.E*
>
> Where A is a subdomain; B is the domain name; C is the top level domain; D/E
> are a file or directory.
>
> Some examples would be:
>
> http://www.swifte.net/
> http://www.cao.swifte.net/petition-sign.html
> http://hsdnetwork.swifte.net/technicians.html
> http://www.hsdnetwork.swifte.net/technicians.html
> http://www.caofund.org/
> http://www.hsdnetwork.com/
>
> Can you tell me how to do this? I would appreciate your help so much!!
>
> -Samuel
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger:
> http://messenger.msn.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>