Using Apache 2.2.22.
I have the following SSL certificates:
Common Name = subdomain.oldsite.com
Subject Alternative Names = subdomain.oldsite.com, *.subdomain.oldsite.com
Common Name = subdomain.newsite.com
Subject Alternative Names = subdomain.newsite.com, *.subdomain.newsite.com
I would like the following rewrite actions:
1) Redirect all unsecure requests to secure site, also requests from
old sites to new site
http://subdomain.oldsite.com => https://subdomain.newsite.com
https://subdomain.oldsite.com => https://subdomain.newsite.com
2) Keep request %{REQUEST_URI} between redirects. Also use wildcard
subdomains, and redirect them to secure new site, keeping wildcard
subdomain.
http://subdomain.oldsite.com/foo/bar.php =>
https://subdomain.newsite.com/foo/bar.php
https://subdomain.oldsite.com/foo/bar.php =>
https://subdomain.newsite.com/foo/bar.php
3) wilcard subdomains, which are NOT ALLOWED should redirected to
secure subdomain.newsite.com (aaa, bbb are not allowed)
http://aaa.subdomain.oldsite.com/foo/bar.php =>
https://subdomain.newsite.com/foo/bar.php
https://aaa.subdomain.oldsite.com/foo/bar.php =>
https://subdomain.newsite.com/foo/bar.php
http://bbb.subdomain.oldsite.com/foo/bar.php =>
https://subdomain.newsite.com/foo/bar.php
https://bbb.subdomain.oldsite.com/foo/bar.php =>
https://subdomain.newsite.com/foo/bar.php
No one is allowed, except those subdomains, which are listed in 4. point.
4) wilcard subdomains, which are ALLOWED should redirected to secure
mysite.subdomain.newsite.com Allowed site:
http://mysite.subdomain.oldsite.com/foo/bar.php =>
https://mysite.subdomain.newsite.com/foo/bar.php
https://mysite.subdomain.oldsite.com/foo/bar.php =>
https://mysite.subdomain.newsite.com/foo/bar.php
My problem is, that
http://aaa.subdomain.oldsite.com/foo/bar.php
shows Server not found error.
All the 1), 2) kind of situations are redirecting fine. I have
problems getting result for 3), 4).
I have the following config files in /etc/apache2/sites-available/
default
default-ssl
subdomain.oldsite.com
subdomain.oldsite.com_ssl
subdomain.newsite.com
subdomain.newsite.com_ssl
mysite.subdomain.newsite.com_ssl
Using VirtualHost config files like this (this is from subdomain.oldsite.com):
<VirtualHost *:80>
ServerName oldsite.com
ServerAlias *.oldsite.com
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+\.)?oldsite.com$ [NC]
RewriteRule ^/(.*) https://newsite.com/$1 [R=301,L]
</VirtualHost>
How can I reach to get good redirection results for 3), 4) ?
Thanks in advance!
------------------------------------------------------------ ---------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx