-
-
Save innomatrix/6aa40d3cf186a4aa7485d5d8e187df10 to your computer and use it in GitHub Desktop.
Vue.JS redirect history mode URL's to hash mode URL's. (Using Nginx)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /web; | |
index index.html; | |
location / { | |
try_files $uri $uri/ @rewrites; | |
} | |
location @rewrites { | |
# old history mode rewrite configuration, now disabled. | |
# rewrite ^(.+)$ /index.html last; | |
# when using hash mode, use this line to auto append the /#/ on the URL's | |
# choose between 301 and 302 based on your preference. | |
return 302 $scheme://$http_host/#$request_uri; | |
} | |
location ~* \.(?:ico|css|ttf|woff|js|gif|jpe?g|png)$ { | |
# Some basic cache-control for static files to be sent to the browser | |
expires max; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment