Reputation: 91
I created a multipage application using vue.js with vue.config.js method i developed it with no problems i created a production build i can access home page however i cannot access other pages like about us, portfolio etc.
What could be the issue?? and how to solve it? is it about the .htacess?
here is my vue.config.js code
module.exports = {
pages: {
index: {
entry: './src/pages/Home/main.js',
template: 'public/index.html',
title: 'Welcome to Appclust',
chunks: ['chunk-vendors', 'chunk-common', 'index']
},
about:{
entry: './src/pages/About/main.js',
template: 'public/index.html',
title: 'About us',
chunks: ['chunk-vendors', 'chunk-common', 'about']
},
portfolio:{
entry: './src/pages/Portfolio/main.js',
template: 'public/index.html',
title: 'Portfolio',
chunks: ['chunk-vendors', 'chunk-common', 'portfolio']
},
testimonials:{
entry: './src/pages/Testimonials/main.js',
template: 'public/index.html',
title: 'Testimonials',
chunks: ['chunk-vendors', 'chunk-common', 'testimonials ']
},
careers:{
entry: './src/pages/Careers/main.js',
template: 'public/index.html',
title: 'Careers',
chunks: ['chunk-vendors', 'chunk-common', 'careers']
},
contact:{
entry: './src/pages/Contact/main.js',
template: 'public/index.html',
title: 'Contact',
chunks: ['chunk-vendors', 'chunk-common', 'contact']
}
}
}
production files
Upvotes: 4
Views: 4880
Reputation: 600
mode:history
for pretty URL in vue-router without hashbang/about
missing index.html as it expected.).htaccess
for the missing routes.RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# otherwise use history router
RewriteRule ^ /index.html
Upvotes: 2