Adding an Extension to Craft URLs
Problem
You want to add a file extension to all of your Craft URLs.
Solution
The solution depends on whether you’re dealing with a request which is routed directly to a template, or a request which displays an entry.
A common example of a request which is routed directly to a template is an index page (say, http://example.com/blog
), which automatically loads the /craft/templates/blog/index.html
template).
In this case, save the template in question with a .php
extension (or a .html.php
extension, if you want the URLs to end with .html
).
For entry pages, you can include the suffix of your choosing when specifying the Entry URL Format on the Settings > Sections > Section Details
page (for example, blog/{slug}.php
). This will work for any extension.
Submitted by Stephen Lewis on 1st February, 2017