RE: [users@httpd] rewrite and virtualdocumentroot question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is what I ended up with and it seems to be working great.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^users.domain.tld$ [NC]
RewriteCond %{REQUEST_URI} !^/horde*$ [NC]
RewriteCond %{REQUEST_URI} !^/mail*$ [NC]
RewriteRule ^/([^\/]+)(.*)$ /exports/home/domain.tld/users/prefix_$1$2 [L]

All of the other domains seem to be unaffected by this and work as expected.  Does this look correct?


> -----Original Message-----
> From: Gary W. Smith [mailto:gary@xxxxxxxxxxxxxxx]
> Sent: Friday, April 21, 2006 11:40 PM
> To: users@xxxxxxxxxxxxxxxx
> Subject: RE: [users@httpd] rewrite and virtualdocumentroot question
> 
> I'm back again and I'm real close to finishing up what I have started
> here.
> 
> I have implemented the following, while still keeping virtualdocumentroot
> in place and it seems to work.
> 
> # ti_ is a login prefix
> RewriteEngine On
> RewriteCond %{HTTP_HOST} ^users.domain.tld$ [NC]
> RewriteRule ^/([^\/]+)(.*)$ /exports/home/domain.tld/users/ti_$1$2 [L]
> 
> My question now is one little thing that I forgot.  I have horde/imp in
> place on that server and the users will still need to access this using
> the alias that I have already put in place some time ago.  The rule above
> will basically cancel that alias out as it will try to rewrite it to a
> different directory.  It's a shared install.
> 
> What would the rewrite condition look like in order to do the above yet
> skip /horde and /mail?
> 
> 
> 
> > -----Original Message-----
> > From: Gary W. Smith [mailto:gary@xxxxxxxxxxxxxxx]
> > Sent: Friday, April 21, 2006 9:28 AM
> > To: users@xxxxxxxxxxxxxxxx
> > Subject: RE: [users@httpd] rewrite and virtualdocumentroot question
> >
> > First I'd like to say thanks for responding.
> >
> > I understand most of what you kicked out in there.  With respect to mod
> > rewrite triggering before vhost_alias, I was wondering if it's possible
> to
> > have mod rewrite just handle the one domain (by a given domain name).
> > That is, can you limit the rewrite condition to just one domain?  I
> don't
> > know much about regexp so please forgive me on this...
> >
> > RewriteMap    lowercase int:tolower
> > RewriteCond   %{HTTP_HOST}  !^$
> > RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}
> > ^http://www.averyparticularserver.com$
> > RewriteCond   /exports/home/%2.%3/users/domain_$1 -d
> > RewriteRule   ^/([^\/]+)(.*)$ /exports/home/%2.%3/users/domain_$1$2 [L]
> >
> > If we limited it to just the one domain, wouldn't virtual still work as
> > expected?
> >
> > > -----Original Message-----
> > > From: Axel-Stéphane SMORGRAV [mailto:Axel-
> > > Stephane.SMORGRAV@xxxxxxxxxxxxxx]
> > > Sent: Friday, April 21, 2006 5:20 AM
> > > To: users@xxxxxxxxxxxxxxxx
> > > Subject: RE: [users@httpd] rewrite and virtualdocumentroot question
> > >
> > > I am afraid that mod_rewrite will process the request *before*
> > > mod_vhost_alias. Therefore, in order to achieve what you want, I think
> > you
> > > will need to abandon mod_vhost_alias and rely solely on mod_rewrite.
> > >
> > > For the user directories, maybe:
> > >
> > > RewriteMap    lowercase int:tolower
> > >
> > > RewriteCond   %{HTTP_HOST}  !^$
> > > RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.*)\.([^.]+)\.([^.]+)$
> > > RewriteCond   /exports/home/%2.%3/users/domain_$1 -d
> > > RewriteRule   ^/([^\/]+)(.*)$ /exports/home/%2.%3/users/domain_$1$2
> [L]
> > >
> > > In the last RewriteCond we test whether a directory exists under
> > > /exports/home/domain.tld/ named the same as the first component of the
> > > requested URL path.
> > >
> > > I think the following should be equivalent to "VirtualDocumentRoot
> > > /exports/home/%-2.0.%-1/virtualdomains/%0":
> > >
> > > RewriteCond   %{HTTP_HOST}  !^$
> > > RewriteCond   ${lowercase:%{HTTP_HOST}|NONE}  ^(.*)\.([^.]+)\.([^.]+)$
> > > RewriteRule	  ^(.*)$ /exports/home/%2.%3/virtualdomains/%1.%2.%3$1
> > >
> > > Wrt the ScriptAlias, I thinks you may resolve it using a combination
> of
> > > DirectoryMatch, add-handler and Options.
> > >
> > > For the user directories, you may want to disable mod_userdir and
> > > incorporate the ~ syntax in the above rewrite rule.
> > >
> > > Try the above rules, set "RewriteLogLevel 3", set the RewriteLog to an
> > > appropriate value and check out the resulting path names.
> > >
> > > -ascs
> > >
> > >
> > > ________________________________
> > >
> > > From: Gary W. Smith [mailto:gary@xxxxxxxxxxxxxxx]
> > > Sent: Thursday, April 20, 2006 8:41 PM
> > > To: users@xxxxxxxxxxxxxxxx
> > > Subject: [users@httpd] rewrite and virtualdocumentroot question
> > >
> >
> > ---------------------------------------------------------------------
> > 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@xxxxxxxxxxxxxxxx
> >    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> 
> 
> ---------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxx
>    "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux