Using Clean URLs
Clean URLs can take hours of work, or massive amounts of boilerplate configuration, on other platforms or servers. Publish your site on Surge, and they will work automatically:
/hello-world
automatically serves/hello-world.html
/foo/bar/
automatically redirects to/foo/bar
if/foo/bar/index.html
isn’t present, but/foo/bar.html
is/foo/bar
automatically redirects to/foo/bar/
if/foo/bar.html
isn’t present, but/foo/bar/index.html
iswww.example.com
automatically redirects toexample.com
, or vice versahttp://example.com
can be redirected tohttps://example.com
Clean URLs on Surge are optimised for search engines, too. These properly setup redirects ensure your pages have one, canonical source. Plus, your www
URL automatically redirects to your root domain (or vice versa).
Everything published on the Surge CDN automatically gets clean URLs. To take advantage of them, publish your project.