Clean URL like on YouTube with Apache/Rocket

Viewed 25

currently I am working on a website and I tried to achieve a clean URL like YouTube has but it doesn't work like I want it to.

As web service I use apache and for my webserver I will use the framework Rocket which is based on the language Rust. For the frontend I only use Javascript, Html and Css.

For example I want to have URLs like this

example.com/login ( exactly! Not example.com/login/ )

example.com/user/username ( again with no / at the end )

example.com/user/username/article?id=1

I found many stuff with .htaccess but nothing that really gave me that.

1 Answers

This depends on what your web site actually is, since you mention .htaccess, I'm assuming you are using something like apache or nginx and just serving static files.

Since you want /login/ to be instead /login I imagine you have a file called /login/index.html that is being served as the directory index. Instead, you can just have login.html and then apply How to remove .html from URL?

Related