After we switched HTG over to HTTPS, we enabled the HSTS headers that force browsers to always talk to * over HTTPS — but we forgot one thing. We were still using Feedburner to serve up

So once we got into the HSTS preload list, nobody could to go anymore, and Feedburner’s custom DNS option didn’t support HTTPS. So it was time to switch to our own thing.

The quick and easily solution was to serve up all requests to a static copy of our RSS feed that we had stored in the index.html file. To force nginx to serve that file whether somebody went to /howtogeek/ or /howtogeek/1 or even /howtogeek1 was as simple as using the try_files directive.

You’ll just want to edit your server or location block with try_files like this:

try_files $uri /index.html;

Replace the /index.html part with whatever your static HTML page is. Once you’re done you’ll have a block kinda like this, which will send every request to the file index.html which should be found in the root directory, in this case /data/webroots/feeds/.

server {
	access_log off; log_not_found off;

	root /data/webroots/feeds/;

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

Restart nginx with a

service nginx reload

command, and you’re all set.

Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »