DEV Community

Cover image for How to fix Page Not Found on netlify

How to fix Page Not Found on netlify

Kapil Pandey on July 19, 2020

Since you are reading this, you surely might have came across the same error as shown in the cover image. I'm not sure if other static site server...
Collapse
 
piyush profile image
Piyush Suthar

And if you want to host a react app on any Cpanel or shared hosting, then adding .htaccess file will be super useful.

<IfModule mod_rewrite.c>

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]

</IfModule>
Enter fullscreen mode Exit fullscreen mode
Collapse
 
nitsuah profile image
nitsuah

I created an account here just to tell you that you are awesome.

Collapse
 
hemant profile image
Hemant Joshi

Life-saving Post
Thank You

Collapse
 
kapi1 profile image
Kapil Pandey

Glad to be of help!

Collapse
 
thatjsdev profile image
Nishant Mendiratta

Worked like a charm, thank you.

Collapse
 
avanikadarji profile image
Avanika

Thank you!! your solution solved my issue.

Collapse
 
mzaini30 profile image
Zen

You can using server configuration: router.vuejs.org/guide/essentials/...

Collapse
 
olusegunadex profile image
olusegunadex

Easy fix;

In your root directory, create a _redirects file;

Add this;

/* /index.html 200
This should fix the issue for React apps hosted on Netlify.

Source: devsntechies.com/fix-page-not-foun...

Collapse
 
myshuker profile image
Myshuker

thanks ...your solution solved my issue...THANKS

Collapse
 
kuzzzzz profile image
kuzzzzz

Thanks this worked like magic

Collapse
 
yogeshdatir profile image
Yogesh Datir

Thanks...

Collapse
 
ineeader profile image
Inee Ader 🐌

This fixed it! Thank you!

Collapse
 
ytrkptl profile image
Yatrik Patel

I’ve ran into this issue before and didn’t exactly know what to do. I guess I’ll try this out and see. Thanks.

Collapse
 
femil profile image
Femil Savaliya

Thank you so much🀟

Collapse
 
kahramanx profile image
Mustafa Kahraman

i make a project just used html, css and js but i tried this way, its not work

Collapse
 
tanvibhakta_ profile image
Tanvi Bhakta

This will fix your issue only if you are using React and React-Router (or other routing library ?).

If you are facing this issue with a website built on a different stack, there is probably a different cause.

Collapse
 
trailblazer007 profile image
Fatoye Oluwaseun

Thanks, I tried this and it worked for me too!