Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: How to remove all .html from the URL | Nignx

$
0
0
The following code works for me to hide the Extensions in the Middle of the URL, but it's redirecting twice:

rewrite ^(.+)\.html(/.*)?$ $1$2 permanent;
rewrite ^/(.*)/$ /$1 permanent;

try_files $uri/index.html $uri.html $uri/ $uri =404;

First, it redirects the end .html
Second, it redirects the middle .html
I require it to be in a single span. Any !dea?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>