How do you set up clean urls?

How do you set up clean urls please?

ie rather than:

https://example.com/about.html

more like:

https://example.com/about/

This is a web server concern but more generally, for your about page, rather than about.html an index.html (or .php or whatever your site is …) file located in the about subdirectory will be automatically displayed with an address of type https://example.com/about/

1 Like

Thank you, that’s easy enough!

Create a .htaccess file (don’t forget the dot in front of .htaccess) and upload it to your server or work with a local server like MAMP Pro.

This is how your .htaccess file has to look:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html

Now in all links on your website you can leave the extension .html away!
And they show like this in the browser:
https://example.com/about/

Good luck!

David

4 Likes