Luna84
Luna84

Reputation: 147

Vuejs history mode - Acces direct category page returns 404 (apache)

I created a mini test here with multiple pages: http://media.eurolines-group.ro/website/ When I work on localhost and acces one of the pages, it works very fine - but when I try to acces it on the server (apache) I get a 404 error - ex: http://media.eurolines-group.ro/website/about. Is there a way that when I enter directly on /about , /contact / jobs - to return the page?

Here are my scripts:

htaccess

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.html [L]
</IfModule>

Router/index.js

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
    }
  ]
})

config.js

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',

Thx in advance!

Upvotes: 0

Views: 566

Answers (1)

Luna84
Luna84

Reputation: 147

I figured it out with someone help - If someone else encounter this problem: I replace all in my htaccess with this:

FallbackResource index.html

Upvotes: 3

Related Questions