Is there any way to serve a custom “Page not found” 404 page in a Vue.js MPA (multipage application) by modifying vue.config.js? (I am not using vue-router)
2
There are 2 answers
2
Michal Levý
On
MPA is just a way to create multiple html files each with its own js bundle - essentially multiple independent Vue apps. As there is no router, there is no client-side routing and every request goes directly to the server. So the server is only place where you can detect the situation (unknown resource requested) and return custom 404 page...
Related Questions in VUE.JS
- Problems with matter.js and i18n in vue.js
- Form Validation not working in custom component Vue
- Authenticating vue app on each route change
- Vue/TailwindCSS - Content is behind Sidebar
- Vue3 Suspense Parent > Child Animation
- Pass dynamic object data via nuxt-link to component
- Failed to resolve import, but the path is valid, and detected as such by VSCode
- how to use less variables in vue components?
- Prevent a webpage from navigating away
- Creating a modal window in product edit page in Shopware6 and saving data to custom table(repository) from a form within the modal window
- How do I fix (or ignore) a TypeScript error that's inside a HTML template?
- Vue.js Checkbox Alignment Issue: Centering Checkboxes Within Table Cells
- How to reset vue product filter?
- Vue display output of two dimensional array
- vue js error when adding bonus items to another item
Related Questions in VUE-COMPONENT
- tsParticles onHover not working on my Vue Project
- How to dynamically switch between two images onclick in Vue.js
- How can i display elements?
- How to toggle a v-if
- Problems in Validations via Web Service in a Vue 3 Application
- vuetify data-table-server binding paging properties
- I need to send an id from read component to update component. The id must be obtained by function updateItem(). But id is not sent to the child pag
- Vuejs child component props does not update when parent component update props value
- Handling a this.$router.replace(href); in vue 2
- diferrence between new vue & vue.createapp
- Is it possible to return a value from the $emit?
- Passing object with reactive properties as a prop triggers child component onUpdated hook when updating parent component state
- Dynamic image loading to not work in Vue project!! On no dynamic everything loads correct
- Error Element Plus Dynamic Tab component in Vue 3
- vue-hotel-datepicker is not working for PST — Pacific Standard Time
Related Questions in VUE-ROUTER
- Pass dynamic object data via nuxt-link to component
- Uncaught TypeError: _projects_js__WEBPACK_IMPORTED_MODULE_2__.default is undefined
- Vue 3 router changing <routing-view/> but not URL
- Vue Router and AWS Amplify
- How to check param route in router
- Vue router with Wordpress
- Route requests as POST on Quasar (Vue3) client application
- Handling a this.$router.replace(href); in vue 2
- How can I conditionally include content without a jarring animation?
- How to efficiently Fetch Dynamic Routes?
- Vue Query get parameters as an array
- Vue prop from optional router param is empty string instead of default value
- My elements will only appear (sometimes) after hot reloading, but not in first load
- Getting blank page while trying to use props in history mode in vue router
- How to get current route in Vue 3 outside of component?
Related Questions in MULTI-PAGE-APPLICATION
- Combination of latest versions of vite, vue, @vitejs/plugin-vue and vite-plugin-virtual-mpa is not including asset urls in build output
- Is it possible to replicate multipage application with webpack without involving backend?
- Dash app dropdown order different on local vs. Heroku
- How do I setup a multi page app using vite?
- How do I use Angular Universal on Deno / Oak, for SSR Rendering and building hybrid MPAs?
- Dash multi-page app failing to detect callback output IDs in different page layouts
- Webpack serve (or another npm script) in ASP.NET Core non-spa project
- How can I add multilanguage support across multiple HTML pages?
- Dash multi-page app using DBC navigation bar
- How does `gtm.start` (Google tag manager) event work in multi-page and single-page hybrid applications?
- How are search engine able to find and locate products within a webpage?
- How to serve SPA in one separate route in Express multipage app?
- Navigation bar won't show itself in a multi-paged tkinter application
- JavaFX: Multiple 'views', 'pages' or scenes - how to approach?
- Issue using focus() for Entry widgets on a multiple page Tkinter application
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
I’ve managed to solve this with only
vue.config.jswith the below. I've followed the approach from a previous answer of mine.And
vue.config.js:It goes without saying, but this only works in production as the routing is done by the web server. When you developed locally, check the 404 page by visiting the 404 page directly.