Replies: 5 comments 4 replies
-
Is this now possible? |
Beta Was this translation helpful? Give feedback.
-
Not using config redirects, but I was able to use |
Beta Was this translation helpful? Give feedback.
-
I had a similar issue that I needed to go from my site's I solved it for now by adding an
<script>
window.location.href = "https://website.com/whatever";
</script> |
Beta Was this translation helpful? Give feedback.
-
I have a draft PR ready: withastro/astro#12979 |
Beta Was this translation helpful? Give feedback.
-
Astro v5.2 ships with the support of external redirects! https://astro.build/blog/astro-520/ |
Beta Was this translation helpful? Give feedback.
-
Summary
At the moment, using
redirects to
https://myfirstsite.com/https://mysecondsite.com/test2
, when it should redirect to the external URL directly.This is something the Vercel CLI correctly warns about:
[WARN] [redirects] Redirecting to an external URL is not officially supported
.Background & Motivation
This is particularly useful to preserve links when migrating URLs into another domain or subdomain.
Goals
My own case was:
mysite.com
blog.mysite.com
, andmysite.com
now hosts an Astro website. Links such asmysite.com/article1
must redirect toblog.mysite.com/article1
.It is possible to use redirect lists in Cloudflare but this costs too much if the list of URLs is too large.
Redirecting with Astro allows to maintain this list more easily (as it can be contained in a plain text file such as a JSON or JS file).
Beta Was this translation helpful? Give feedback.
All reactions