i created this static website using html,tailwind.
it consist of link which will lead to other page where i have other information like “Projects” for info. about all my projects, “About” containing info about me and so on…
but when i click on those links they show page not found , i have tried adding the _redirects file and writing /* /index.html 200 solution but it doesn’t work , please help me out ,i can provide code if you need it but i think it would not necessary as my code has no issues.
Hi @Nitin_web
Can you share the repository you are deploying from?
If you set the redirection rule as you mentioned, then your redirection file is nor sat right, please share your _redirects file and netlify.toml, so we can understand what the issue.
Repository
Here, this repository i am using
Repository
This is the repository
The _redirects
file serves no purpose in this case. Delete it.
The “projects” and “contacts” links don’t work as there are no corresponding files in the repository. The “about” link may not work due to the redirect.
Also, try downloading the deployed site to see what files where actually deployed
First of all you _redirect file has the wrong format and that’s why it was not working.
/* /index.html 200
This mean all unfounded files/assets will be redirected to homepage
Other than that, @coelmay’s reply said it all
yes i have not finished working on the projects and contacts pages yet , but my about page is complete and linked properly as well but still doesn’t work,what could be wrong ? sorry if i sound confused cause i am actually i don’t know what is going wrong here
so what should i do now , i have deleted the redirects file as well but the problem is still not resolved
another thing i want to add when i run this site using vite in my computer it works completely fine every link works , but after deploying every link like my github, linkedin is working except the “About” link
i just downloaded the site and it’s only showing index.html file and not the about.html file ?
What build settings are you using?
I cloned the repository, and the same thing happens locally, so this is about the configuration of the project.
Not having used Vite much, I checked out Setup Multiple Pages with VITE - YouTube and made some changes.
First, the directory structure is now
.
├── node_modules
├── package-lock.json
├── package.json
├── postcss.config.js
├── src
│ ├── about.html
│ ├── images
│ │ ├── GitHub-Mark
│ │ │ ├── PNG
│ │ │ │ ├── GitHub-Mark-120px-plus.png
│ │ │ │ ├── GitHub-Mark-32px.png
│ │ │ │ ├── GitHub-Mark-Light-120px-plus.png
│ │ │ │ ├── GitHub-Mark-Light-32px.png
│ │ │ │ └── GitHub-Mark-Light-64px.png
│ │ │ └── Vector
│ │ │ ├── GitHub-Mark.ai
│ │ │ └── GitHub-Mark.eps
│ │ ├── GitHub-Mark-64px.png
│ │ ├── Tech_Tiles_02.mp4
│ │ ├── icons8-gmail-logo-50.png
│ │ ├── icons8-linkedin-circled-64.png
│ │ ├── istockphoto-877787978-170667a.jpg
│ │ └── manface.webp
│ ├── index.html
│ └── style.css
├── tailwind.config.js
└── vite.config.js
Second, created a vite.config.js
file (based on the video)
import { resolve } from 'path'
import { defineConfig } from 'vite'
const root = resolve(__dirname, 'src')
const outDir = resolve(__dirname, 'dist')
export default defineConfig({
root,
build: {
outDir,
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(root, 'index.html'),
about: resolve(root, 'about.html')
}
}
}
})
Then run npm start
and the about page works.
Also added a build
script to the package.json
"build": "vite build"
Set the build command in the Netlify Dashboard to npm run build
and the publish directory to dist
and things should work fine (I haven’t deployed, just tested locally.)
Also, don’t commit the node_modules
directory to GitHub. There is no need. Netlify (and all other services to my knowledge) install dependencies listed in the package.json
and ignore the node_modules
directory in the repository.