RE: silent URL redirect/cloak with mod_rewrite

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

 




From: Hank [mailto:heskin@xxxxxxxxx]
Sent: Monday, April 21, 2008 1:43 AM
To: users@xxxxxxxxxxxxxxxx
Subject: silent URL redirect/cloak with mod_rewrite

Hello All,
 
I've tried about 100 combinations and searched google over and over, but I can't find nor figure out how to do this simple task.
 
I have one webserver with sites at:
 
/home/user/public_html/  ( http://basedomain.com site points here) 
/home/user/public_html/siteA
/home/user/public_html/siteB
 
I have domain names like this:  http://domainA.com and http://domainB.com
 
I want to *silently* redirect http://domainA.com to  /home/user/public_html/siteA
and http://domainB.com to  /home/user/public_html/siteB
 
Now keep in mind the literals "domainA" is not the same as the directory name "siteA", and same for domainA/siteA.
 
I have found several ways to non-silently redirect http://domainA.com to http://basedomain/siteA, but that's not good enough.  It needs to be a silent re-direct.
 
I realize I could do this with virtual domains if I had access to httpd.conf, but I don't on this server.
 
Thanks,
-Hank
If I understand you correctly, you have registered domainA and domainB and the domain names point to your server's IP in DNS. You want to map domainA to ../siteA and domainB to ../siteB. You don't have access to the server's httpd.conf directly and only have access to .htaccess files.
 
Then I don't think this is possible. Here's why:
 
The NameVirtualHost mechanism is specifically designed for this situation, but this has to be used in the main config - it is impossible to do this in .htaccess. The problem is that although the request (for domainA, say) might come in with a header like "Host: domainA", without a NameVirtualHost directive and a corresponding VH, this will be ignored and the request will go the main docroot.
 
BTW, "redirect" has a very specific meaning in HTTP - it means to send a 301 or 302 redirect response that causes the browser to submit a new request to a new URL. It is always non-"silent" - ie, the browser location display shows the new URL. By "silent redirect", I think you mean proxying - where the server gets content from a new URL and returns it to the browser without telling it where it came from. That's a different thing and is never referred to as redirection.

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

 
 
This message is for the named person's use only. It may contain confidential, proprietary or legally privileged information. 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. The sender's company reserves the right to monitor all e-mail communications through their networks.


[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