I have a very simple static site hosted on nginx.
Everything works fine, but I would like to clean up the path showed in the browser bar so that it only shows example.com
instead of example.com/index.html#someanchor
The site has several subpages in their own HTML-files, but I would still prefer to always just show the "root domain".
This problem seems to be very elusive as I can't find a single hit on Google on how to do this.
Here's the server block from my sites-available config file:
server {
listen 80;
listen [::]:80;
root /var/www/example.com;
index index.html index.htm index.nginx-debian.html;
server_name example.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
0 Answers