#Discord dashboard development
4 messages · Page 1 of 1 (latest)
Hi @trim zenith. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Based on the knowledge sources provided, Astro does support redirects, including the ability to configure custom domains and subdomains, which could be useful for your multibot dashboard project.
Astro offers several ways to implement redirects:
- Configured Redirects: You can specify permanent redirects in your Astro config file. As of Astro v2.9.0, you can map old routes to new routes, including external URLs:
import { defineConfig } from "astro/config";
export default defineConfig({
redirects: {
"/old-page": "/new-page",
"/blog": "<https://example.com/blog">
}
});
You can also customize the redirection status code:
export default defineConfig({
redirects: {
'/other': {
status: 302,
destination: '/place',
},
}
})
- Dynamic Redirects: You can use the
Astro.redirect()method to redirect users dynamically based on certain conditions:
---
import { isLoggedIn } from "../utils";
const cookie = Astro.request.headers.get("cookie");
// If the user is not logged in, redirect them to the login page
if (!isLoggedIn(cookie)) {
return Astro.redirect("/login");
}
---
- Domain Configuration: For subdomain handling specifically, Astro v4.9.0 introduced the
domainsoption for internationalization, which allows you to customize domains on a per-language basis for server-rendered projects:
export default defineConfig({
site: "<https://example.com",>
output: "server", // required, with no prerendered pages
adapter: node({
mode: 'standalone',
}),
i18n: {
defaultLocale: "en",
locales: ["en", "fr", "pt-br", "es"],
prefixDefaultLocale: false,
domains: {
fr: "<https://fr.example.com",>
es: "<https://example.es">
}
},
})
While this feature is primarily designed for internationalization, the underlying mechanism for handling different subdomains could potentially be adapted for your multibot dashboard use case.
For your specific use case of a multibot dashboard with subdomain redirects, Astro would be a viable option, especially if you're using server-side rendering (SSR) with an adapter like @astrojs/node or @astrojs/vercel. The domain configuration feature, combined with dynamic redirects, could provide the functionality you need to switch between different bot management interfaces.