Simple redirect; I'm tooo stupid for that ..

 
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting
View previous topic :: View next topic  
Author Message
M*I*B
-


Joined: 05 Dec 2019
Posts: 16
Location: Germany

PostPosted: Fri May 01, 2020 8:46 pm    Post subject: Simple redirect; I'm tooo stupid for that .. Reply with quote

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 View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1044

PostPosted: Sun May 03, 2020 1:27 pm    Post subject: Re: Simple redirect; I'm tooo stupid for that .. Reply with quote

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 View user's profile Send private message
M*I*B
-


Joined: 05 Dec 2019
Posts: 16
Location: Germany

PostPosted: Sun May 03, 2020 2:29 pm    Post subject: Reply with quote

... 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 View user's profile Send private message
pkSML
-


Joined: 29 May 2006
Posts: 916
Location: Michigan, USA

PostPosted: Mon May 04, 2020 5:07 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
M*I*B
-


Joined: 05 Dec 2019
Posts: 16
Location: Germany

PostPosted: Mon May 04, 2020 5:46 pm    Post subject: Reply with quote

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 View user's profile Send private message
admin
Site Admin


Joined: 03 Mar 2002
Posts: 1044

PostPosted: Tue May 05, 2020 10:33 am    Post subject: Reply with quote

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 View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> URL Rewriting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group