Operating System - Linux
1821544 Members
2248 Online
109633 Solutions
New Discussion юеВ

URL redirects via apache 2.2 challenge

 
Al_56
Regular Advisor

URL redirects via apache 2.2 challenge

l'm configuring an Apache 2.2 install on linux for "name based hosting", and have created the vhosts.

we have 10 sites that we'd like to redirect to 1 site with a directory for each of the sites.

So what l'd like to do is redirect(302) from a URL to another URL such as:

Redirect http://www.xx.com http://www.aaa.com/xx

Redirect http://www.yy.com http://www.aaa.com/yy

The redirect option however only work from a directory to a URL/dir.

Any advice on how to do this hopefully easy 302?

Thanks in advance,

Alan
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: URL redirects via apache 2.2 challenge

Shalom Alan,

I'd do it with 10 directives.

redirect http://www.xx.com http://www.aa.com/xx

There are options you can place directly after the redirect. This may affect whether or not the configuration works. Have you tried them?

# redirections will not work. See also the UseCanonicalName directive.
# redirections work in a sensible way.
# Redirect allows you to tell clients about documents which used to exist in
# Redirect permanent /foo http://www.example.com/bar
# 1) plain text 2) local redirects 3) external redirects
# We use Alias to redirect any /error/HTTP_.html.var response to
# The following directive disables redirects on non-GET requests for
# redirects for folders with DAV methods.
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "^WebDrive" redirect-carefully
BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
BrowserMatch "^gnome-vfs" redirect-carefully

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Al_56
Regular Advisor

Re: URL redirects via apache 2.2 challenge

Thanks mate for the advice.

There are 50 name hosts under the same IP, and l have the same number of redirects.

l did try this originally thinking should work, but with no luck as yet.

So either l've placed the redirects in the wrong place in the http.conf file, or it doesn't work with "name based hosting" perhap.

Canonial name method won't work with this application l think.

Maybe l'll try it without the name based hosting (since it's redirecting at the domain name level).

If anyone knows of a way to acheive this please let me know.

Al
Steven E. Protter
Exalted Contributor

Re: URL redirects via apache 2.2 challenge

Alan,

My business in the US does just what you are saying, named based hosting. I'm relatively certain this can be done with any version of apache.

I don't use redirect except to make my webmail work. Its www.investmenttool.com/webmail and I use redirect to make the name webmail.investmenttool.com work properly.

I also do extensive redirects on the web server for my employer. I believe your issue can be worked out, though it may take more extensive testing and work than is possible through the forums.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Karsten Breivik_1
Frequent Advisor

Re: URL redirects via apache 2.2 challenge

Hi, Al.

It seems to me that you could be in need of a reverse proxy. Since you are running Apache, you might be interested in using the mod_proxy module for it. Here is a howto:

http://www.apacheweek.com/features/reverseproxies

Also, you might be interested in using Squid for the same purpose

http://www.visolve.com/squid/whitepapers/reverseproxy.php

I am running the apache revproxy module and it has been a lifesaver for me. It also enables me to access the webpages from behind the firewall that the servers live behind using the domain name and not the IP address or an internal DNS server.

poi
Al_56
Regular Advisor

Re: URL redirects via apache 2.2 challenge

It is resolved.

l had the redirects on their own outside of the virtual host block. Once l put them into their own blocks all worked fine.

Thanks for your help.

Alan
Al_56
Regular Advisor

Re: URL redirects via apache 2.2 challenge

closed