You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Leandro Reis <lr...@hotmail.com> on 2006/02/13 21:24:12 UTC

[users@httpd] redirection question

Hi all,

I currently host a web site that uses the URL (not real name) 
http://machine1.mycorp.com. Also, I had the DNS updated so that the URL 
http://anotheraddress.mycorp.com redirects to my site.

What I would like to do is, for users who go to the 
http://anotheraddress.mycorp.com ONLY, to redirect to a subpath of the main 
URL, for example, http://machine1.mycorp.com/anotheraddress.html.

In the Apache documentation, I have only been able to find redirection 
instructions within the same URL. The version I'm running is 2.0.54.

Any help will be immensely appreciated,
Leandro Reis

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ 
Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


---------------------------------------------------------------------
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] redirection question

Posted by Joshua Slive <jo...@slive.ca>.
On 2/13/06, Leandro Reis <lr...@hotmail.com> wrote:
> Hi all,
>
> I currently host a web site that uses the URL (not real name)
> http://machine1.mycorp.com. Also, I had the DNS updated so that the URL
> http://anotheraddress.mycorp.com redirects to my site.
>
> What I would like to do is, for users who go to the
> http://anotheraddress.mycorp.com ONLY, to redirect to a subpath of the main
> URL, for example, http://machine1.mycorp.com/anotheraddress.html.
>
> In the Apache documentation, I have only been able to find redirection
> instructions within the same URL. The version I'm running is 2.0.54.

It's not clear what you want to happen if people go to a subpage under
anotheraddress.  I'll assume you want every request for that site to
be redirected to anotheraddress.html on machine1.

You can do this using mod_rewrite or name-based virtual hosts.  I'll
show the second technique:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerName machine1.mycorp.com
  DocumentRoot ....
</VirtualHost>
<VirtualHost *:80>
  ServerName anotheraddress.mycorp.com
  RedirectMatch / http://machine1.mycorp.com/anotheraddress.html
</VirtualHost>

Joshua.

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