Re: mod_rewrite & open_basedir & pear
| From: | Stig S. Bakken | Date: | Tue, 28 May 2002 09:20:03 +0000 |
| Subject: | Re: mod_rewrite & open_basedir & pear | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-1473@lists.php.net to get a copy of this message | ||
On Tue, 2002-05-28 at 11:11, Alexei Tenitski wrote:
> Hi Stig
>
> > > mod_rewrite is used to _hide_ urls from users and to _extend_ url with
> > > additional params.
> >
> > Is there anything stopping you from doing the mod_rewrite things in PHP
> > with a 404 error handler? :-)
>
> Well... I'm working on a system which would allow resellers
> provide various our services as their own at their own prices.
>
> Fully customized by reseller process where clients order services.
>
> There's an account generated for each reseller.
>
> http://11.22.33.44/~some_reseller/
>
> Subfolder with reseller private files is
> kept there (eg pictures they use on their pages or css files).
>
> In addition to it there's a .htaccess which redirects all requests
> (with an appended param &reseller_id=12345) which are not
> requests for the files in a "includes" folder to the directory
> on the server where main process remain.
>
> This system allows me to do whatever i want to with the process,
> change filenames, add features without any need to update anything
> in reseller account directories.
>
> Can i be that flexible with a rewrite by php?..
>
> Say, I can't do header('Location ...') cause it will
> reveal that the process is reselling which is not acceptable...
>
> Do you know ways to implement above by php only?
One technique is to have an empty document root and only a 404 handler
(you need to have "Options -Indexes" and a 403 handler to catch accesses
to "/").
The 404 handler just examines the URL and either does a readfile() (plus
content-type and last-modified headers) from your internal document
root, or a virtual() call to route the call to somewhere else served by
Apache.
I've used this with great success to implement an interface to a CMS
providing plain URLs (ala /news/2002052801.html) instead of query-style
URLs (ala /news.php?id=2002052801).
- Stig