httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konrád Lőrinczi <klorin...@gmail.com>
Subject Re: [users@httpd] Apache Rewrite - Redirect Wildcard Subdomain
Date Thu, 15 Sep 2016 14:54:27 GMT
I think you found the problem.
Likely the wildcard DNS is not set.

I wrote to our system admin to set the DNS.

Thanks for the idea!
Webmaster33

2016.09.15. 16:23 ezt írta ("Rodrigo Cunha" <rodrigo.root.rj@gmail.com>):

> about Situation 3
> as you set up your dns?
> the subdomains are directed to the correct server?
> in http://aaa.subdomain.oldsite.com/foo/bar.php dsn is different from
> http://subdomain.oldsite.com/foo/bar.php are different subdomains.
>
> 2016-09-15 10:33 GMT-03:00 Webmaster33 <webmaster33@gmail.com>:
>
>> 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@httpd.apache.org
>>
>>
>
>
> --
> Atenciosamente,
> Rodrigo da Silva Cunha
>
>

Mime
View raw message