Mod Rewrite - RewriteRule - redirections with absolute urls doesn't work #57693
Labels
area-middleware
Includes: URL rewrite, redirect, response cache/compression, session, and other general middlesware
Is there an existing issue for this?
Describe the bug
When creating mod_rewrite RewriteRule with redirection to different host/domain name (absolute url) it doesn't work properly because instead changing entire redirected url, destination is appended to requested url.
Expected Behavior
For redirections RewriteRule is internaly creating RedirectAction object that takes path base url always from:
context.HttpContext.Request.PathBase
but what if redirection destination is full url to other hostname/domain? In such case base url should be taken from destination and not like now from requested url.When for example I have rule:
RewriteCond %{REQUEST_URI} ^./test/.$ [NC]
RewriteRule ^(.*)$ https://google.pl$1 [R=307,L]
When I enter: https://myhost.mydomain/test/abc I expect to be redirected to https://google.pl/test/abc but instead final url is: https://myhost.mydomainhttps://google.pl/test/abc
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
9.0.100-preview.7.24407.12
Anything else?
No response
The text was updated successfully, but these errors were encountered: