I am building a small blog using a PHP and MySQL CMS (no WordPress etc) and have hit a “skill wall”.
My blog post template is post.php, which uses a GET variable to use a post slug to get content from the database. As such, an example URL could look like this: example.com/post.php?s=my-post-slug.
What I would like to do is use a single template (post.php), but have the URL be: example.com/my-post-slug.
I understand that this is likely an .htaccess task, and have found the following code:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
I tried using this, swapping index.php out for post.php, but no luck.
How can this be done?