Fix redirects by checking redirect field instead
This commit is contained in:
parent
f87f962c41
commit
994969ba54
1 changed files with 7 additions and 2 deletions
|
@ -113,11 +113,16 @@ export const integration = ({ generateHtaccessFile, errorPages, redirects, custo
|
||||||
// Automatic error pages and Astro redirects
|
// Automatic error pages and Astro redirects
|
||||||
() =>
|
() =>
|
||||||
(!error &&
|
(!error &&
|
||||||
routes.reduce((acc, { type, route, redirectRoute }) => {
|
routes.reduce((acc, { type, route, redirect }) => {
|
||||||
if (!error) {
|
if (!error) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "redirect":
|
case "redirect":
|
||||||
acc.push(`RedirectMatch 301 ^${route}(/(index.html)?)?$ ${redirectRoute!.route}`);
|
const destination = typeof redirect === "string" ? redirect : redirect?.destination;
|
||||||
|
if (destination) {
|
||||||
|
acc.push(`RedirectMatch 301 ^${route}(/(index.html)?)?$ ${destination}`);
|
||||||
|
} else {
|
||||||
|
logger.warn(`No destination found for redirect route "${route}"! Skipping.`);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "page":
|
case "page":
|
||||||
if (errorPages === undefined) {
|
if (errorPages === undefined) {
|
||||||
|
|
Loading…
Reference in a new issue