Forum Moderators: phranque

Message Too Old, No Replies

dynamic virtual hosts mixing it with rewritemaps

need to dynamicallly allocate rewrite maps on a per virtual host basis..

         

tekin

2:47 pm on Sep 2, 2005 (gmt 0)

10+ Year Member



Hi.
New to Apache, but having a whale of a time!

our server is setup to handle dynamic virtual hosting with the following directive:


<VirtualHost 00.00.00.00:80>
ServerName blah.blah.blah.co.uk
ErrorLog /var/log/error_log
CustomLog /var/log/sites_access_log ald
VirtualDocumentRoot /domains/%1.1/%1.2/%0/public_html
User nobody
Group sites
</VirtualHost>

I currently have the following three rewrite maps outside of this virtual host block in the httpd.conf.


RewriteMap products prg:/domains/d/o/domain.co.uk/rewrite_progs/rewritemap_product.php
RewriteMap categories prg:/domains/d/o/domain.co.uk/rewrite_progs/rewritemap_category.php
RewriteMap manufacturers prg:/domains/d/o/domain.co.uk/rewrite_progs/rewritemap_manufacturer.php

This has worked fine up until now, as I have only needed rewrites on one of the virtual domains. Now I need to have seperate rewrite maps for seperate domains. Question is, how do I do it?

Thanks in advance,

Tekin

mack

11:16 am on Sep 5, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



For this I tend to place the rules within each site, as opposeed to httpd.conf I place the rules in a .htaccess file at the www level of each virtual host.

Then specify the file in httpd.conf

#
#
# AccessFileName: The name of the file to look for in each directory
# for access control information.
#
AccessFileName .htaccess

This allows you to have a totaly different set of rules per site/domain.

Hope this helps.

Mack.

tekin

9:19 am on Sep 12, 2005 (gmt 0)

10+ Year Member



Thanks Mack, will give this a go..

I am a little concerned with the security implications though, specifically if I am allowing my clients to have ftp access to the their www directory. Or would it be enough to make sure that their login does not have access rights to the .htaccess file?

tekin

12:04 pm on Sep 13, 2005 (gmt 0)

10+ Year Member



Hi.
I've just gone through my httpd.conf and it appears AccessFileName .htaccess is already there.

I remember now trying to do this before. I do indeed set all my rewrite rules in .htaccess files, but the RewriteMap programs must be specified in the httpd.conf as they need to be started up by Apache when it initialises. So back to square one, how can I specify dynamic paths to my RewriteMap programs so each domain has its own ones?

If anyone can help, I would be most grateful as I need to get a series of websites running with seperate rewrite maps for each asap.