RE: [users@httpd] rewrite and virtualdocumentroot question

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

 



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



We are running the following in the httpd.conf file.  This works well for our virtual domain hosting.  

VirtualDocumentRoot /exports/home/%-2.0.%-1/virtualdomains/%0

VirtualScriptAlias /exports/home/%-2.0.%-1/virtualdomains/%0/cgi-bin

For the users we have a prefix as part of their username.  For example, the domain domain.tld might have the following prefix domain_ so the user accounts would look like domain_bob, domain_john, etc.

We have a need to strip the this prefix off for a particular domain that we are hosting and expose their home directory.  The users home directories are always under a partitular path:

/exports/home/domain.tld/users/prefix_username

What we would like to do is have all traffic for /bob to go to the folder /exports/home/domain.tld/users/domain_bob.  The second part of this is that we only want this to happen for domain.tld, not domain2.tld or domain3.tld.

Is this possible?  If so, how would I approach this?  

I figure the first part of the equation is getting /domain_bob to map to /exports/home/domain.tld/users/domain_bob but I don't know how to do this when we are running VirtualDocumentRoot.

It should also be noted that there is no content on this particular virtual host.  It was specifically create for the purposes of putting home directories on the network.

Any help would be greatly appreciated.

Gary Smith


---------------------------------------------------------------------
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