Skip to content

Instantly share code, notes, and snippets.

@fedealvz
Last active August 16, 2023 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fedealvz/6c9260c72c7976b94c5cf2d8a78be41e to your computer and use it in GitHub Desktop.
Save fedealvz/6c9260c72c7976b94c5cf2d8a78be41e to your computer and use it in GitHub Desktop.
Apache .htaccess para Vue, vue-router / Controller MVC
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>

Para que todas las solicitudes web de las subpáginas sean ruteadas al Index File y no den error 404, debemos colocar el código en un archivo .htaccess en la misma carpeta raíz donde se encuentra nuestro index.html

El hosting o servidor Apache deben permitir el uso de archivos .htaccess

Obtenido de https://router.vuejs.org/guide/essentials/history-mode.html#Apache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment