You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike <mi...@levrah.net> on 2003/01/29 23:00:35 UTC

[users@httpd] Server-Wide Rewrite w/out Multiple .htaccess Files

Hello everyone.

I'm trying to find a way to manage (identical) rewrite statements for 
multiple vhosts. I have no syntax problems with the rewrite statements 
themselves. We have them working already on all vhosts, and have had for 
quite some time.

Think of a dozen (or more) .htaccess files.
Each having the same/identical rewrite statements in them.
Alot of (otherwise) unnecessary duplication...
...looking for a way to have "server-wide" rewrites that will work on/for 
all vhosts.

I would like to just vi one file, restart web service (if necessary?) and 
logout. :)  But, what happens now is that I find myself updating and 
re-uploading multiple .htaccess files when we need to add (or delete) an 
entry. It's not difficult. But it is getting tediously annoying. :)

Soooo, I'm looking to see if anyone knows a good way to get around having 
to update and upload multiple .htaccess files? I've tried a couple of 
methods already; with limited success. Here is a brief outline with results:

1) Added test rewrite statements in httpd.conf before/above vhosts 
directives using directory / as the starting point and [F] to display 
forbidden page. This seems to work, but not consistently.

2) Same as #1 but the rewrites were added after/below vhosts directives. 
Same result.

The rewrite statement used during my tests was a simple statement to deny 
access - show forbidden page - based on my connection IP. This way, it 
would only affect me and the vhosts would remain up and web accessible 
otherwise.

Anyone have any ideas?
Other ways - I'm not thinking of - to do the same thing?

Thanks!
-mike

P.S. I know it's not prudent to mess around with updating the httpd.conf 
file itself very much. So once I get the process working properly and 
consistently, I plan to put the statements into a file and use Include to 
include that file in httpd.conf. This assumes someone doesn't tell me 
there's a better way to do it, of course. :-)


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Server-Wide Rewrite w/out Multiple .htaccess Files

Posted by Mike <mi...@levrah.net>.
At 08:43 PM 1/29/2003, you wrote:
>How about putting symlinks in place of each individual .htaccess, all of
>which point to your one "master" .htaccess file?
>
>I foresee any of these being a problem however, if one of the virtual hosts
>needs a unique line in .htaccess, but I think your current setup has the
>same problem, so maybe it's not a problem in you case.  :)
>
>HTH,
>Peter Janett

Yeah. That's what I'm also trying to do some forward thinking on.

Right now, there's no "special setup" with regard to .htaccess handling. I 
would like to leave it that way if at all possible, while still being able 
to have the server handle "htaccess-like statements" on a server-wide basis.

I'm going to try the other suggestion someone else made about using 
"inherit" and see if that works because I do want to allow vhosts to 
control their own .htaccess files at some future date without me 
intervening for "special handling" for lack of a better way of saying it.

-mike 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Server-Wide Rewrite w/out Multiple .htaccess Files

Posted by Christos Karras <ck...@capella.org>.
Mike wrote:

> Hello everyone.
>
> I'm trying to find a way to manage (identical) rewrite statements for 
> multiple vhosts. I have no syntax problems with the rewrite statements 
> themselves. We have them working already on all vhosts, and have had 
> for quite some time.

You could add all your RewriteRules in httpd.conf (or a file Included 
from httpd.conf) before your VirtualHosts and then, in each VirtualHost:

RewriteEngine On
RewriteOptions inherit

Then each time you add/change a RewriteRule and restart apache, it will 
affect all your vhosts that have the inherit option


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Server-Wide Rewrite w/out Multiple .htaccess Files

Posted by Peter Janett <ml...@newmediaone.com>.
How about putting symlinks in place of each individual .htaccess, all of
which point to your one "master" .htaccess file?

I foresee any of these being a problem however, if one of the virtual hosts
needs a unique line in .htaccess, but I think your current setup has the
same problem, so maybe it's not a problem in you case.  :)

HTH,

Peter Janett

New Media One Web Services
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PostgreSQL coming soon!

http://www.newmediaone.net
webmaster "at "newmediaone.net
(303)828-9882


----- Original Message -----
From: "Mike" <mi...@levrah.net>
To: <us...@httpd.apache.org>
Sent: Wednesday, January 29, 2003 3:00 PM
Subject: [users@httpd] Server-Wide Rewrite w/out Multiple .htaccess Files


> Hello everyone.
>
> I'm trying to find a way to manage (identical) rewrite statements for
> multiple vhosts. I have no syntax problems with the rewrite statements
> themselves. We have them working already on all vhosts, and have had for
> quite some time.
>
> Think of a dozen (or more) .htaccess files.
> Each having the same/identical rewrite statements in them.
> Alot of (otherwise) unnecessary duplication...
> ...looking for a way to have "server-wide" rewrites that will work on/for
> all vhosts.
>
> I would like to just vi one file, restart web service (if necessary?) and
> logout. :)  But, what happens now is that I find myself updating and
> re-uploading multiple .htaccess files when we need to add (or delete) an
> entry. It's not difficult. But it is getting tediously annoying. :)
>
> Soooo, I'm looking to see if anyone knows a good way to get around having
> to update and upload multiple .htaccess files? I've tried a couple of
> methods already; with limited success. Here is a brief outline with
results:
>
> 1) Added test rewrite statements in httpd.conf before/above vhosts
> directives using directory / as the starting point and [F] to display
> forbidden page. This seems to work, but not consistently.
>
> 2) Same as #1 but the rewrites were added after/below vhosts directives.
> Same result.
>
> The rewrite statement used during my tests was a simple statement to deny
> access - show forbidden page - based on my connection IP. This way, it
> would only affect me and the vhosts would remain up and web accessible
> otherwise.
>
> Anyone have any ideas?
> Other ways - I'm not thinking of - to do the same thing?
>
> Thanks!
> -mike
>
> P.S. I know it's not prudent to mess around with updating the httpd.conf
> file itself very much. So once I get the process working properly and
> consistently, I plan to put the statements into a file and use Include to
> include that file in httpd.conf. This assumes someone doesn't tell me
> there's a better way to do it, of course. :-)
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org