Question

How to enable clean url on Debian 9?

Hello,

I have a website and for example I have url like this “example.com/games” and it should show the page with games but it shows error:

Not Found

The requested URL /games was not found on this server.

What I have to do to show a page instead of an error?

Thanks!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Hey friend!

Good question. There are different ways to handle this. The easiest example would be to create a folder named “games” in the website’s document root, and then add an index file which contains your content.

A more common example these days is to use your web server’s rewrite functionality to funnel all URLs into index.php which translates the URL into the right content request, returning the desired content based on the URL given. Wordpress does this on Apache by writing rewrite rules to a .htaccess file in the website’s document root, for example.

Jarland

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thank You Jarland,

the first way looks interesting.