codigo0/public/.htaccess

37 lines
1.1 KiB
ApacheConf
Raw Normal View History

# Apache SPA fallback configuration
# Para servidores Apache, esto redirige todas las rutas a index.html
# Asegúrate de que mod_rewrite esté habilitado
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# No redirigir si el archivo existe
RewriteCond %{REQUEST_FILENAME} !-f
# No redirigir si el directorio existe
RewriteCond %{REQUEST_FILENAME} !-d
# No redirigir archivos estáticos (assets, imágenes, etc.)
RewriteCond %{REQUEST_URI} !^/assets/
RewriteCond %{REQUEST_URI} !^/favicon\.ico$
RewriteCond %{REQUEST_URI} !^/manifest\.json$
RewriteCond %{REQUEST_URI} !^/sw\.js$
# Redirigir todo lo demás a index.html
RewriteRule ^ index.html [L]
</IfModule>
# Headers para cache
<IfModule mod_headers.c>
# No cachear index.html
<FilesMatch "index\.html$">
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires "0"
</FilesMatch>
# Cachear assets estáticos
<FilesMatch "\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$">
Header set Cache-Control "public, max-age=31536000, immutable"
</FilesMatch>
</IfModule>