How to have custom URL and remove .html extension without Wordpress?

View other answers to this thread
Start a personal dev blog on your domain for free and grow your readership.

3.4K+ developers have started their personal blogs on Hashnode in the last one month.

Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more

Mario Giambanco's photo

As htaccess was mentioned as a tag, it would be assumed your using Apache

  1. create a .htaccess file if it doesn't already exist (it might be / probably is hidden)
  2. paste this into it

     Options +FollowSymLinks
     RewriteEngine On
     RewriteCond %{REQUEST_FILENAME} -f                [OR]
     RewriteCond %{REQUEST_FILENAME} -d
     RewriteRule .  -                                  [L]
     RewriteRule ^$ index.php                          [QSA,L]
     RewriteRule ^(.*)$ index.php?id=$1

so given - about becomes the value of $_GET['id'] in PHP

In index.php do as you please with that variable - include($_GET['id']); or run a case on it or ...

"Roughly" how Wordpress works. index.php responds to everything; all files / pages / blog posts are handled by index.php and it's functions / classes.

Any href's link to it as above - "/about" or "/contact" or "/products"