Redirecting between two domains hosted by netlify

PLEASE help us help you by writing a good post!

I have two domains on netlify Both sites are identical at the moment so i am deploying to them from one site. However I obviously want the sitemaps to be different in each domain so I have two sitemaps in my github repository sitemap.xml associated with the 2 domains. I have tried redirecting from sitemap.xml to sitemap-co-uk.xml in the alboothart.co.uk domain usin a netlify.toml file …
from = “https://www.alboothart.co.uk/sitemap.xml
to = “https://www.alboothart.co.uk/sitemap-co-uk.xml
status= 200
force = true
and the redirect failed to process quoting invalid redirect rule
I have tried adding build commands such as
command = “npm run build && cp _redirects dist/_redirects”
publish = “dist”
but this failed in the build stage.
the site that actually built is https://silly-lewin-ca1ec2.netlify.app
Anyone any clues on what I am doing wrong

  • we need to know your netlify site name. Example: gifted-antelope-58b104.netlify.app
  • DNS issues? Tell us the custom domain, tell us the error message! We can’t help if we don’t know your domain.
  • Build problems? Link or paste the FULL build log & build settings screenshot

The better the post - the faster the answer.

@alan_booth Welcome to the Netlify community.

Are you using smart quotes in your actual code, or just in this post?

I am using the same quotes as in the post

@alan_booth Have you tried using straight / dumb quotes instead?

thanks for that. looked closely at the closing quotes in the file and found a space between xml and the quotes. On removing this space the file has processed and the redirect is working . Thanks again

1 Like