Error VueJS di Apache The Request URL Not Found

Halo Teman - teman semuanya kali ini saya akan kembali menulis tentang VueJS yang dimana saya menemukan error ketika upload roject ke server webserver dengan output error seperti pada cover di atas. Kurang lebih seperti ini output error nya.

Not Found

The requested URL /user/detail-pelatihan/5930 was not found on this server.

 

Setelah baca - baca documentasinya ternyata harus menambahkan .htaccess untuk apache, untuk link dokumentasinya https://router.vuejs.org/guide/essentials/history-mode.html#apache

Caranya seperti ini,

Buat sebuah file .htaccess di dalam folder public

Setelah buat nama File, .htaccess isikan nama filenya dengan content seperti berikut ini.

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

Setelah di isi content, simpan dan coba rebuild untuk Project VueJsnya.

$ npm run build

Setelah itu coba di akses ulang untuk projectnya. Demikianlah artikel pendeknya, semoga bermanfaat ya.

Related Articles

Comments