vue router in Apache server cause problem

154 Views Asked by At

my question is about vue3 and vuerouter@4 i recently deployed my small vue project in apache server, i configured .htaccess most router link working perfectly handled by apache https://example.com/note, https://example.com/login ... , but my issue is when i try to access https://example.com/note/any it work if i start browsing from the home but when i reload it or directly go to https://example.com/anything it always blank, i tried many apache htaccess still not work pleaase help. (in local perfectly working only in production have this issue , i think problem is related to apache .htaccess) here is my router/index.js

{

            path: "/note/:anytext([A-Za-z0-9]{1,10})",
            name: "notes",
            component: Notes,
            
        },

my .htaccess file

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

dev tool console show this error , i hosted in Hestia cp

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

i have issue related to vue router apache server

edit: now i got solution thanks to phil

i was used this in vite config base: './',

but base should be '/'

0

There are 0 best solutions below