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

How to get static caching working on urls without html extensions

$
0
0
I have a website that i'd like to cache, the page urls are set up for example :

http://www.mywebsite.com/en/about-us

which i've set up a catch-all to the file index.php for processing.

I am able to generate files in the folder such as /en/about-us.html.gz on the fly, which is fine.

However, I don't want people to type in the .html extension at the end of the url just to get the static file, how do i get redirecting or whatever working, so that if the end user types in http://www.mywebsite.com/en/about-us , and the file /en/about-us.html.gz exists, then use that file, else just fall back to the catch-all. I'd also like it to take into account that if it's internet explorer, then provide a gunzip'd version of the cache file.

Is this at all possible in nginx, if so, can you post me the solution? I had it working in apache, but don't really want to go back to apache if I can help it.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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