View previous topic :: View next topic |
Author |
Message |
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Fri May 01, 2020 8:46 pm Post subject: Simple redirect; I'm tooo stupid for that .. |
|
|
Hello there,
I have gave up ... May someone can help?
I just like redirect ...
http(s)://mail.domain.tld?{any parameter}
to
https://domain.tld/mail?{any parameter}
FROM: http or https with any parameter as tail
TO: HTTPS with the parameter from FROM _________________ DLzG
Micha |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
Posted: Sun May 03, 2020 1:27 pm Post subject: Re: Simple redirect; I'm tooo stupid for that .. |
|
|
M*I*B,
Create a host with HTTP+HTTPS for domain mail.domain.tld .
In that host, create a URL rewriting rule with the following parameters:
Code: | Type: Global
Virtual Path regular expression: ^/$
If this rule matches: Perform an external redirection
Redirect to: https://domain.tld/mail
Append Query String: checked
Escape Redirection Location: checked
Status Code: 302
|
Press OK twice and restart the server.
The above assumes that only the root of mail.domain.tld will be redirected. But it does not cover URL with a path in them such as http://mail.domain.tld/some/path/to/file.ext . You could probably give us more details about what to do with such paths (redirect or process normally).
Also, should you redirect from mail.domain.tld when there are parameters after ? only or should you always redirect even with empty or no parameters? _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Sun May 03, 2020 2:29 pm Post subject: |
|
|
... at 1st ty for the answer ...
Q: That you have explain redirect mail.domain.tld and also all other like domain.tld to domain.tld/mail... Or am i wrong?
I will write is like that:
IF
(http OR https) AND (mail.domain.tld OR mail.domain.tld?*)
THEN
REDIRECT to https://domain.tld?*
ENDIF
In simple words: Redirect ONLY subdomain "mail." to "/mail" with all given parameter, if some. _________________ DLzG
Micha |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Mon May 04, 2020 5:07 pm Post subject: |
|
|
M*I*B wrote: | Q: That you have explain redirect mail.domain.tld and also all other like domain.tld to domain.tld/mail... Or am i wrong? |
Aprelium's reply is exactly what you need to do to accomplish your objective.
If you click on Host --> Configure --> General --> Hostnames, you will see which hosts/domains for which the URL rewriting will occur. (This should be mail.domain.tld) If your host is set up to handle HTTP+HTTPS, then the URL rewrite will occur over both protocols.
The part of the URL after the question mark is called the query string. That will be tacked on the URL rewrite by specifying "Append Query String," as Aprelium mentioned. _________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Mon May 04, 2020 5:46 pm Post subject: |
|
|
Ok, I believe that; you know I have no idea about RegEx ^^
I entered the redirect in two different domains exactly as specified above (of course with the correct domain names; of course ...)
domain1 haven't a subdomain "mail".
I call mail.domain1.tld and got an 403
domain 2 have a subdomain "mail"
I call mail.domain2.tld and stay on mail.domain2.tld
In both case the rewriting don't work.
What I'm doing wrong??? _________________ DLzG
Micha |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
Posted: Tue May 05, 2020 10:33 am Post subject: |
|
|
M*I*B,
An URL is made of a schema (http or https), an ip or domain name possibly with a port, a virtual path, and possibly a query string introduced by ? .
The Web server will deal with the schema and the domain name to determine the host that will serve the URL.
At the host level, the virtual path is important and it's what URL rewriting uses to know if a rule should be applied.
So our question was "what to do with the virtual path" of the URLs for domain name mail.domain.tld (whether they come on http or https)?
Regarding the regular expression, it's not very complex. $/^ means match with a virtual path which is exactly equal to / . A quick overview on the syntax of regular expressions is in https://aprelium.com/abyssws/articles/regex-basics.html . We highly recommend checking it as it proves useful for many tasks.
So why it didn't work? Error 403 is probably due to the fact that the redirection goes to a non-handled domain name.
In all cases, we suggest that you contact us by email with your abyss.conf and the exact URLs you have tested and which did not work. A quick review of your configuration will help us determine what went wrong. _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
|
Back to top |
|
|
Paulie -
Joined: 20 Feb 2016 Posts: 24
|
Posted: Tue Apr 20, 2021 8:35 pm Post subject: |
|
|
Could you not do this for your mail redirect...
and end with this to redirect everything else to https://domain.com/*
|
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
|
Back to top |
|
|
Paulie -
Joined: 20 Feb 2016 Posts: 24
|
Posted: Wed Apr 21, 2021 5:56 am Post subject: |
|
|
And you have a host set up for both
http+https://domain1.com and http+https://domain2.com
in the Web Server Console? |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Wed Apr 21, 2021 6:19 am Post subject: |
|
|
... yes, definitely ...
Host 1:
* http & https with Option Exclusively Serve On HTTPS
* Point physically to the webside
* Servernames:
domain1.com (https- Master & target for all Host 1 rules)
domain1.eu
domain2.com
domain2.eu
www.domain1.com
www.domein1.eu
www.domain2.com
www.domain2.eu
Host 2:
* http & https with Option Exclusively Serve On HTTPS
* Point physically to the webmailer
* Servernames:
mail.domain1.com (https- Master & target for all Host 2 rules)
mail.domain1.eu
mail.domain2.com
mail.domain2.eu
In my brain there is a ghost that tell me I need a rule that say ...
IF NOT https://domainX.com REDIRECT to https://domainX.com _________________ DLzG
Micha |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
Posted: Wed Apr 21, 2021 9:08 pm Post subject: |
|
|
Could you please contact our technical support by email to speed up working o a solution?
Please let us know the exact requirements too. :) _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Thu Apr 22, 2021 12:28 pm Post subject: |
|
|
... hmmm ...
I believe all the requirement are written down in my last post.
I also like to work/talk with all here on a solution to help others in the future.
That's actually the point of a forum ... isn't it?
What speaks against posting a solution here so that other users can benefit from it? I am pretty sure that I am not the only user who comes across such tasks now and in the future ... _________________ DLzG
Micha |
|
Back to top |
|
|
pkSML -
Joined: 29 May 2006 Posts: 952 Location: Michigan, USA
|
Posted: Sun Apr 25, 2021 2:31 pm Post subject: |
|
|
M*I*B wrote: | ... yes, definitely ...
Host 1:
* http & https with Option Exclusively Serve On HTTPS
* Point physically to the webside
* Servernames:
domain1.com (https- Master & target for all Host 1 rules)
domain1.eu
domain2.com
domain2.eu
www.domain1.com
www.domein1.eu
www.domain2.com
www.domain2.eu
Host 2:
* http & https with Option Exclusively Serve On HTTPS
* Point physically to the webmailer
* Servernames:
mail.domain1.com (https- Master & target for all Host 2 rules)
mail.domain1.eu
mail.domain2.com
mail.domain2.eu
In my brain there is a ghost that tell me I need a rule that say ...
IF NOT https://domainX.com REDIRECT to https://domainX.com |
Move Host 2 ahead of Host 1.
Quote: | * http & https with Option Exclusively Serve On HTTPS |
The above option will take care of the thought below:
Are you also saying you want all these domains:
_________________ Stephen
Need a LitlURL?
http://CodeBin.yi.org |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Mon Apr 26, 2021 7:39 am Post subject: |
|
|
... yes, that's right ...
I see three blocks here.
The 1st one make https if http called via option "Exclusively Serve On HTTPS". I think that this one have the highest priority due it's the 1st touch.
The 2rd one as rule have to redirect all mail.* subs to mail.domain1.com
The 3rd one as rule have to redirect all with and without www.*, except mail, to domain1.com
Can it be better to go an other way?
1. http -> https by "Exclusively Serve On HTTPS"
2. mail.* -> mail.domain1.com
3. www.* -> domain1.com
4. NOT domain1.com -> domain1.com
... ok, now I've confused myself *grrr*
!!! Not that we talk at different things: the whole domain-block for webside is one host, the whole mail.* block for webmail is an other host (on the same machine) !!!
BTW: Over the years I try again and again to understand/learn RegEx but sometimes two things never goes together like RegEx and my Brain... _________________ DLzG
Micha |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
Posted: Mon Apr 26, 2021 9:35 pm Post subject: |
|
|
M*I*B,
We can simplify the whole setup to:
1. http -> https by "Exclusively Serve On HTTPS"
2. mail.* -> mail.domain1.com
3. anything else -> domain1.com
The problem is that with HTTPS, you cannot use the default host only. You should have host where you declare all possible host names so that the ACME certificate is valid for all of them.
In other words, you'll need host 1 associated with all named variations of mail.* including mail.domain1.com. This host should have a URL rewrite rule to redirect to mail.domain1.com if host name is different from mail.domain1.com.
Host 2 should also be associated with all named variations of all other recognized domain names including www.* and domain1.com. It should also have a URL rewrite rule to redirect to domain1.com if host name is different from domain1.com.
Both hosts should have the "Exclusively Serve On HTTPS" enabled for all their virtual paths (/). _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
M*I*B -
Joined: 05 Dec 2019 Posts: 33 Location: Germany
|
Posted: Sat May 01, 2021 9:55 pm Post subject: |
|
|
admin wrote: | M*I*B,
In other words, you'll need host 1 associated with all named variations of mail.* including mail.domain1.com. This host should have a URL rewrite rule to redirect to mail.domain1.com if host name is different from mail.domain1.com.
Host 2 should also be associated with all named variations of all other recognized domain names including www.* and domain1.com. It should also have a URL rewrite rule to redirect to domain1.com if host name is different from domain1.com.
|
... that is all given; I have post that some posts before. But I can quote my post here again:
M*I*B wrote: | ...
Host 1:
* http & https with Option Exclusively Serve On HTTPS
* Point physically to the webside
* Servernames:
domain1.com (https- Master & target for all Host 1 rules)
domain1.eu
domain2.com
domain2.eu
www.domain1.com
www.domein1.eu
www.domain2.com
www.domain2.eu
Host 2:
* http & https with Option Exclusively Serve On HTTPS
* Point physically to the webmailer
* Servernames:
mail.domain1.com (https- Master & target for all Host 2 rules)
mail.domain1.eu
mail.domain2.com
mail.domain2.eu
... |
_________________ DLzG
Micha |
|
Back to top |
|
|
admin Site Admin
Joined: 03 Mar 2002 Posts: 1296
|
Posted: Mon May 03, 2021 6:41 pm Post subject: |
|
|
M*I*B,
Can you send us your abyss.conf file for review? At this stage, we cannot see what's wrong with the setup you have described. It may be a little glitch elsewhere so we need to have a look on the whole configuration. _________________ Follow @abyssws on Twitter
Subscribe to our newsletter
_________________
Forum Administrator
Aprelium - https://aprelium.com |
|
Back to top |
|
|
|