🐛 Fixed redirects to absolute URLs (#10777)
closes #10776 When the "to" property of the redirect includes a host (implying an external or fully qualified url) we skip replacing any paths and redirect straight to it, rather than modifying the URL with the sites sub-directory.
This commit is contained in:
parent
a4f119cb7f
commit
f2e60806da
@ -53,7 +53,9 @@ _private.registerRoutes = () => {
|
||||
const fromURL = url.parse(req.originalUrl);
|
||||
const toURL = url.parse(redirect.to);
|
||||
|
||||
toURL.pathname = fromURL.pathname.replace(new RegExp(redirect.from, options), toURL.pathname),
|
||||
toURL.pathname = (toURL.hostname)
|
||||
? toURL.pathname
|
||||
: fromURL.pathname.replace(new RegExp(redirect.from, options), toURL.pathname);
|
||||
toURL.search = fromURL.search;
|
||||
|
||||
res.set({
|
||||
|
Loading…
Reference in New Issue
Block a user