I’ve searched for help on this, and expected to find some because it doesn’t seem too out of the ordinary, but failed.
I have deployed my site to Netlify.
I have a _redirects file which has 22 entries.
In the deployment on Netlify, I can see it has processed 22 entries.
So far so good.
Two of the entries point to the same page.
/ContactUs.aspx /contact
/AddReview.aspx /contact
Netlify seems to process the two rules, but only the second one works.
I have swapped them round and still the same, only the second works.
Is what I am trying to do possible? This seems a pretty straight forward thing to do.
Thanks for your help - unfortunately that doesn’t work.
I have read this in the docs but this talks about the first part of the redirect - not the second part:
" The redirects engine will process the first matching rule it finds, reading from top to bottom. Rules in the _redirects file are always processed first, followed by rules in the Netlify configuration file."
I’ve taken a look and it looks like our redirects engine has parsed the first rule in your redirects file incorrectly! I’m not 100% sure why it has done this but I would encourage you to remove the tabular indents in your _redirects file.
e.g. please try:
/ContactUs.aspx /contact 301! /AddReview.aspx /contact 301! /Music.aspx /music 301!
etc.
As I stated at the top, no matter what order I put these two rules in, it’s always the second one that works.
I have just switched them around though as you asked for, and the same thing happens.
I’m not sure whether you have access to, but feel free to change the _redirects file yourself if it will help with debugging. The site is not live yet and I have no problem with you making changes if it will help speed up the fix.
The only difference between your site and other, working _redirects files is that your lines are wrapped with \r\n. This is a Windows versus Linux/Mac nomenclature difference.
Can I ask that you edit the file, ensuring that the \r character isn’t captured?
I’ll be honest, I didn’t hold out much hope for that as all the other rules worked, I wondered why that would make a difference.
I also thought I can’t have been the only person to have tried this on a Windows machine and it fail.