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: GitHub - AHTARazzak/personal_website: Personal website (https://alirazzak.info) coded using MEAN stack & deployed using Netlify
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.
Netlify builds, deploys, and hosts your frontend.
Learn how to get started, find examples, and access documentation for the modern web platform.
I’m transitioning my domain from
domain.co to cooldomain.com. I added a redirect to my sites (both sites), it’s being processed according to the number of redirects in the build log (16 redirects), however once deployed, it doesn’t appear to be in effect.
http://beta.domain.co/* https://beta.cooldomain.com/:splat 301!
https://beta.domain.co/* https://beta.cooldomain.com/:splat 301!
http://beta.domain.co https://beta.cooldomain.com 301!
Please let me know if further details or context would be helpful!
Any support would b greatly appreciated!
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
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
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
redirects to https://alirazzak.info/about https://alirazzak.info/
additionally that a 404, 302, 302 from (among other errors in the future) also redirect to https://alirazzak.info/ 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
Sounds… funky? I don’t think we want to have 3 different redirect rules on the same page!
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!
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:
If there is a better solution
how I would get any 404 page to redirect to
Hope that made my inquiry a bit more clear & I look forward to hearing back!
@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
/* /about 404 will send your users to the /about page with a 404, if the page doesn’t exist.
Hope it helps!