Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Trying to sort out redirects in virtual host config |
|
Author |
|
emob
Joined: 05 May 2016 Posts: 2
|
Posted: Thu 05 May '16 17:59 Post subject: Trying to sort out redirects in virtual host config |
|
|
I'm having a problem with a virtual host configuration
I have two web sites
www.abc.com (web1/2 ~/home/abc/www/*.html)
www.xyz.com (web1/2 ~/home/abc/www/xyz/*.html)
www.abc.com behaves like I want it to
but for the xyz.com domain currently xyz.com and www.xyz.com dont behave the same
xyz.com
web1.xyz.com
web2.xyz.com
all redirect to
http://www.abc.com/xyz/ (this is what I want)
www.xyz.com
redirect to
www.abc.com (this is not what I want)
I want www.xyz.com to redirect to http://www.abc.com/xyz/ the same as xyz.com does.
Eventually I want www.xyz.com to apear in the URL field but I understand that this is a rewrite which which I'm not ready for yet
I have two hosts and a load balancer
the load balancer is at .51 and the hosts web1 and web2 are at .35 and .36 respectively
I have tried several DNS configurations with no effect
This is what I currently have:
xyz.com A 3600 123.456.789.51
web1.xyz.com A 3600 123.456.789.35
web2.xyz.com A 3600 123.456.789.36
www.xyz.com CNAME 3600 xyz.com
This is my virtual host definition:
########## xyz.COM ##########
<VirtualHost *:80>
ServerName xyz.com
ServerAlias web1.xyz.com
AddDefaultCharset UTF-8
Redirect / http://www.abc.com/xyz/
</VirtualHost>
I tried adding a second definition to capture the www. part but it didnt change anything
########## WWW.xyz.COM ##########
<VirtualHost *:80>
ServerName www.xyz.com
ServerAlias web1.xyz.com
AddDefaultCharset UTF-8
Redirect / http://www.abc.com/xyz/
</VirtualHost>
Cent OS 7 3.10.0-229.20.1.el7.x86_64
Server version: Apache/2.2.31 (Unix)
Server loaded: APR 1.4.8, APR-Util 1.5.2
Compiled using: APR 1.4.8, APR-Util 1.5.2
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/usr/local/apache2"
-D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf" |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7371 Location: Germany, Next to Hamburg
|
Posted: Thu 05 May '16 21:02 Post subject: |
|
|
YOu want yxz.com in the url but the content of of other domain/xyz folder? if yes a reverse proxy config might be a solution |
|
Back to top |
|
emob
Joined: 05 May 2016 Posts: 2
|
Posted: Thu 05 May '16 22:07 Post subject: |
|
|
ultimately I want xyz.com to be in the url filed rthare than abc.com/xyz
However the immediate task is to understand the virtual host configuration better so that
both www.xyz.com and xyz.com both redirect to www.abc.com/xyz
currently
xyz.com -> www.abc.com/xyz
and
www.xyz.com -> www.abc.com |
|
Back to top |
|
|
|
|
|
|