Reputation: 597
i've set up mode to history:
const router = new VueRouter({
mode: 'history',
routes:[
...
{
path: '*',
name: '404',
components: { default: Page404},
}
})
created 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>
everything working as expected wrong urls falls to 404 page... the problem is with deep urls for example website.com/wrong/wrong/wrong images don't appear in the 404 page !
Upvotes: 0
Views: 204
Reputation: 597
well it had nothing to do with i was missing a slash /
this works on level one url:
<img class="title" src="img/sad404.png" alt="404 not found" />
this is the correct way:
<img class="title" src="/img/sad404.png" alt="404 not found" />
Upvotes: 1