Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

326
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!