#Characters in CSS URL cause redirect

2 messages · Page 1 of 1 (latest)

dawn schoonerBOT
#

Hi @proven gale. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The knowledge sources do not contain enough information to directly address this specific issue about @_@astro characters in generated CSS filenames causing 307 redirects.

However, based on what the knowledge sources do cover, there are a couple of potentially relevant options:

1. Customize output filenames using Rollup options

You can override the default asset naming pattern in your astro.config.mjs to avoid problematic characters in filenames: [customizing output filenames]

import { defineConfig } from 'astro/config';

export default defineConfig({
  vite: {
    environments: {
      client: {
        build: {
          rollupOptions: {
            output: {
              assetFileNames: 'static/[name]-[hash][extname]',
            },
          },
        },
      },
    },
  },
});

This would change where and how assets (including CSS) are named in the build output, potentially avoiding the @ character issue.

2. Change the assets directory

You can also change the _astro output directory name using build.assets: [build options]

{
  build: {
    assets: '_custom'
  }
}

That said, the root cause of why @_@astro appears in your CSS filenames and triggers a redirect is not explained in the available knowledge sources. I'd recommend filing a bug report or checking the Astro GitHub issues for more specific guidance on this behavior.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: