Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

334
Vistas
After deployment of vue app only homepage works, subpages not found

I have created a subdomain test.example.com from cPanel. I then built my Vue app using

npm run build

and zipped the whole dist folder to upload to the server. Once uploaded I expanded the zip file so the files are on the server.

This works perfectly for my home page, check, however, any of the subpages return the 404 while this issue is not observable on the localhost.

I don't understand how to fix this.

I use the vue.config.js with

module.exports = {
    publicPath: '/'
}

and also the links to subpages look fine but just don’t work.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You are using history mode in your router, in order for it to work all requests need to go back to index.html

All you need to do is add a simple catch-all fallback route to your server. If the URL doesn't match any static assets, it should serve the same index.html page that your app lives in.

Since you are using cPanel I would assume that your server is using Apache.

Therefore you will need to create a .htaccess file to redirect all requests to index.html. You will need to create the .htaccess file inside your public_html folder (assuming that is where your application code lives). Then add the following.

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda