Vuejs2 Vuejs历史记录模式-访问直接类别页面返回404(apache)
我在这里创建了一个包含多个页面的小型测试: 当我在localhost上工作并访问其中一个页面时,它工作得非常好-但是当我尝试在服务器(apache)上访问它时,我得到一个404错误-例如:。 当我直接在/about、/contact/jobs上输入时,是否有方法返回页面 以下是我的脚本: htaccessVuejs2 Vuejs历史记录模式-访问直接类别页面返回404(apache),vuejs2,vue-router,Vuejs2,Vue Router,我在这里创建了一个包含多个页面的小型测试: 当我在localhost上工作并访问其中一个页面时,它工作得非常好-但是当我尝试在服务器(apache)上访问它时,我得到一个404错误-例如:。 当我直接在/about、/contact/jobs上输入时,是否有方法返回页面 以下是我的脚本: htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ -
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
export default new Router({
mode: 'history',
base: '/website/',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/about',
name: 'About',
component: About
},
{
path: '/contact',
name: 'Contact',
component: Contact
},
{
path: '/jobs',
name: 'Jobs',
component: Jobs
}
]
})
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: 'http://media.eurolines-group.ro/website',
config.js
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
export default new Router({
mode: 'history',
base: '/website/',
routes: [
{
path: '/',
name: 'Home',
component: Home
},
{
path: '/about',
name: 'About',
component: About
},
{
path: '/contact',
name: 'Contact',
component: Contact
},
{
path: '/jobs',
name: 'Jobs',
component: Jobs
}
]
})
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: 'http://media.eurolines-group.ro/website',
提前谢谢 我在别人的帮助下解决了这个问题-如果其他人遇到这个问题:我会用以下内容替换htaccess中的所有内容:
FallbackResource index.html
我在别人的帮助下解决了这个问题-如果其他人遇到此问题:我将用以下内容替换htaccess中的所有内容:
FallbackResource index.html