Vue Router Netlify 404 Fix

User
Okay after deploy to netlify vue js app internal routing is working but when page refresh then 404
Assistant
This is a common issue when deploying a Vue.js app (especially with Vue Router in **history mode**) to Netlify. When you refresh a page or directly visit a nested route (e.g., `/about`), Netlify looks for a file at that path, which doesn't exist—hence the 404.

### **Solution: Create a `_redirects` file**

1. In your `public/` directory (or `static/` if using Nuxt), create a file named:

_redirects

2. Add the following line to it:

/*    /index.html   200

This tells Netlify to redirect all requests to `index.html`, allowing Vue Router to handle the routing.

### **Steps:**

1. Create `public/_redirects` (if not already):

echo "/*    /index.html   200" > public/_redirects

2. Rebuild and redeploy your app to Netlify.

Let me know if you’re using Vite, Nuxt, or something else—I’ll tailor it more specifically if needed.

Leave a Comment

Your email address will not be published. Required fields are marked *