RE: [users@httpd] Only redirecting, but not changing the root?

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

 



> -----Original Message-----
> From: Lennart Aangeenbrug [mailto:lennart@xxxxxxxxxxxxxxx]
> Sent: Dienstag, 13. Dezember 2005 09:26
> To: users@xxxxxxxxxxxxxxxx
> Subject: [users@httpd] Only redirecting, but not changing the root?
> 
> 
> Hi all,
> 
> Yesterday i've posted a question and no one replyed :-( Maybe i 
> explained it not clear enough or is it not solvable. Here is 
> my question 
> again in another words:
> 
> How can I forward an user to a specific location, > without < 
> changing 
> the root? 

It is not clear what you mean by "the root". Do you mean the "DocumentRoot"? It's always better to use exact keywords in technical questions rather than making up your own shorthand.

> For example:
> www.example1.com == goes to ==> public_html/example1/, the root stays 
> public_html/
> www.example2.com == goes to ==> public_html/example2/, the root stays 
> public_html/
> www.example3.com == goes to ==> public_html/example3/, the root stays 
> public_html/

If you do mean DocumentRoot, then I'm confused. The DocumentRoot never changes. So now I'm beginning to think you mean the path displayed in the browser location bar... If so, you could do something like this (untested):

- set up a default VH, possibly on localhost, which has "DocumentRoot /path/to/public_html"
- set up one name-based VH for each site which proxies (or rewrites in proxy-mode) the request to the default server

eg:

# default VH

Listen 127.0.0.1
<VirtualHost 127.0.0.1:80>
  DocumentRoot /path/to/public_html
</VirtualHost>

# site VHs

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName www.example1.com

  ProxyPass / http://127.0.0.1/example1/
  ProxyPassReverse / http://127.0.0.1/example1/

  or 

  RewriteRule ^/(.*) http://127.0.0.1/example1/$1 [P]

</VirtualHost>

repeat as required...

How it works:

- Incoming request has Hostname = www.example1.com so is routed to the VH with that ServerName. 
- VH makes a second request to localhost with path /example1
- this request is routed to the default VH on localhost
- default VH fetches the page and returns it to example1 VH
- example1 VH passes the page back to the client

Rgds,
Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 


> 
> The root public_html contains nothing more than a .htaccess file. It 
> should recognize which domain is adressed and then send it to 
> the right 
> dir. Why I want this? I keep in the dir  public_html/ several other 
> dirs, like graphic & tools I need for all sites.
> 
> gr, Lennart
> 
> ---------------------------------------------------------------------
> 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
> 
> 
Diese E-mail ist eine private und persönliche Kommunikation. Sie hat keinen Bezug zur Börsen- bzw. Geschäftstätigkeit der SWX Gruppe. This e-mail is of a private and personal nature. It is not related to the exchange or business activities of the SWX Group. Le présent e-mail est un message privé et personnel, sans rapport avec l'activité boursière du Groupe SWX.
 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this message in error, please notify the sender urgently and then immediately delete the message and any copies of it from your system. Please also immediately destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. The sender's company reserves the right to monitor all e-mail communications through their networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of the sender's company.

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