How to enable clean url on Debian 9?

February 14, 2019 388 views
Apache PHP Debian

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!

2 Answers
jarland MOD February 15, 2019
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

Thank You Jarland,

the first way looks interesting.

Have another answer? Share your knowledge.