_redirects directing a hole into my head

Hello,

I’ve been surfing around trying to find a solution for redirecting 404s to specific netlify pages & decided the _redirects organisation is the solution.

My netlify site name is: boring-cray-8f7cfc.netlify.app
The github repro is: https://github.com/ternlef11/profilepage

I am not getting an error as such as my _redirects is not working and I am not sure why.

This is the current format of my _redirects:

I have placed the file in the root, src,& public site folders.

I’ve tried looking through these topics for support but haven’t succeeded yet.



Please let me know if further details or context would be helpful!

Regards,
A

Any support would b greatly appreciated!

Hey there!

So, in your last deploy, we can see all 4 rules are processed. They’re in the right location, don’t worry!

You may want to check out our redirects debugging guide.

But, in short… because the /about page exists, your rules won’t redirect to the / page. You’ll need to change the rule to a 301!, 404! or similar. The ! makes sure the rule takes effect, even if the / page exists.

If you explain what you want to direct to, and from, we can dive in on a specific rule :slight_smile:

1 Like

Hey!

Thank you heaps for the response & support. I spent the day working on the ite & trying to implement what you’ve suggested although am having a hard time.

I’m trying to achieve it so the domain https://alirazzak.info/about redirects to https://alirazzak.info/
additionally that a 404, 302, 302 from https://alirazzak.info/ (among other errors in the future) also redirect to https://alirazzak.info/

Hope that makes sense, if not please feel free to ask me for further context &/or clarification!

Looking forward to hearing back :slight_smile:

Hey @turnleft,

Sounds… funky? I don’t think we want to have 3 different redirect rules on the same page! :face_with_hand_over_mouth:

However, for the first one, you can configure /about / 301! if you want /about to show in the URL bar, else you can do /about / 200!

1 Like

Hey @Pieparker

Appreciate the advice so far.

More specifically what I want from the _redirects is a solution to when I refresh on one of the routed pages (https://alirazzak.info/aptitude) for example and it not give me the netlify 404 error.

I considered _redirects as a solution to this as it would mean any error messages would instead be routed to the about page but now I am wondering:

  1. If there is a better solution
  2. how I would get any 404 page to redirect to https://alirazzak.info/about

Hope that made my inquiry a bit more clear & I look forward to hearing back!

Hey @turnleft, so this is 404ing because of the ! in the rule. I understand what you need now and a ! is not necessary – this will force the rule, regardless of whether the page you’re looking for exists or not :slight_smile:

/* /about 404 will send your users to the /about page with a 404, if the page doesn’t exist.

Hope it helps!