Mod Rewrite - RewriteRule - redirections with absolute urls doesn't work
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### 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_
Contributor guide
Assessment
This issue has not been assessed yet.