Another way of gettin clean URL - feature Suggestion?

Hi everybody, I’m Lennart from Fehmarn Island, located in the baltic sea close to Denmark.
Ive been using Sparkle for a while. I`am actually building a new website for my business.

I found a way to get clean URL trough using htacces. I was using the following code

RewriteEngine On
#Optional: RewriteCond %{HTTP_HOST} www.domain.tld$ [NC,OR]
#Optional: RewriteCond %{HTTP_HOST} domain.tld$ [NC]
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.html [NC,L]
ErrorDocument 404 /404.html

after I uploaded everything works as expected, only the URL’S still have .html extension, what I wanted to get rid of. I think it is necessary to change the Hyperlinks. I can browse my websites pages without typing “.html”, so I can reach the different pages now with or without the html extension. I know I can define hyperlinks as external targets, and leave “open in new browser” unchecked.
I am looking for a simpler way of altering my hyperlinks. Would it be possible to add a field where I can alter the links also when I create links trough the menu item workflow, when I select pages of my site as target? (I hope you get what I 'm trying to point out).

I should apologize for my english, I have not used it for several years and I think I’m rusted in a bit.



@Fehmarnufaktur, Welcome onboard! :slight_smile:

I’m curious as to why you need your URL to show without the “.html” extension?

Hi, I think it looks way cleaner and more professional.
Also you can achieve URLs like, without folders.

Sorry not really sure what you are asking for… you can set a custom filename already, in the page settings. What would you need beyond that?

htaccess based solutions exist, but not all servers support htaccess, and it’s generally very fragile to set up (mod_rewrite-based solutions being the hardest to wrap your head around and troubleshoot if anything goes wrong).

I know that htaccess based solutions can be difficulty, but in my opinion it is better than working with folders.

I simply would like to set hyperlinks without the .Html extension.

I can do so by defining an link as an external hyperlink, and telling Sparkle not to Open it in a new window, but it would be nice to choose a page as linktarget, like I can do it right now in the create hyperlink dialog.

Maybe do it in a way like it is done with the custom filenames.

I just want to achieve cleaner URL without defining dozens of folders.
I took WordPress Links as example. I just want to mime the same link structure. So a site visitor has to remember just for example.

So you have the htaccess set already, and you can set the custom filename omitting the extension. So my question is: are you missing anything?


I`m just missing something in the workflow for me. I think this image makes more clear what I mean.
If I use the way sparkle is doing the links I can choose easy to which website I’d like the hyperlink refer to, and also to which anchor. But using this way Sparkle adds the .html extension which is fine as long as I don’t want my htaccess to work for me :smiley:

I can only produce hyperlinks without .html as long as I define the hyperlinks as “external target”. So it would be good to have a chance to alter the hyperlinks also when I use the workflow from my above image

You can still use external links and add to the external URL just # for the site top, or #anchorname.

However this is fiddly and what I was thinking was of actually removing the file extension from the page settings:


but I just realized the files on the server do need to have the .html extension so that you can make an .htaccess rule to route the extension-less request to the file with extension.

I will check your idea with a .htaccess rule. You are right I can add an external URL. But it is really fiddly an not that comfortable as Sparkle is usually :grinning:
I was thinking more of a “Sparkle way”.

Instead of adding an external URL or wrighting a .htaccess rule I was thinking of a checkbox like “show path”, where I can simply alter the hyperlink Sparkle generates. I’m not that pro user in .htaccess things.
My knowledge is based on blogs and several tutorials that I could find online.

But beside all this technology stuff I’d like to thank you for all the help.

In the end it is just another way as opposed to what you are used too. The extension “.html” is the default on a hosting server and if it isn’t present then the next thing becomes “.php” extension from what I have experienced in the past.

If im honest I just want to hide the page extension instead of getting rid of it.
I like the site structure that you can achieve with a cms like Wordpress, but there are a lot of things where I think Wordpress is overkill.

For a “marketing point of view” it is simpler to remember a URL without an extension. Think about typically URL that you see on “big” sites.

@Fehmarnufaktur, In your experience does the likes of Google also take to it? Does it prefer the “clean” approach? It does makes sense from a marketing point of view as you say! :slight_smile:

I`m not sure if Google lays weight to it in it’s algorithm, but I think it’s the finishing touch (der letzte Schliff in german) to a professional website.

I also think that many potential visitors are used to it, so I definitely think it’s worth it :smile: