php - How to setup a permalink structure like wordpress with just postname after the domain name?
My title should be enough to make you understand that what I am actually trying to do. I just want to make a simple permalink structure like this:
example.com/post-name
I have written all the code to get user request, my code is
$permalink = trim($_SERVER['PHP_SELF'], "/");.
After that I have managed to get the user request whenindex.php
is added in the URL like this:
example.com/index.php/post-name.
But this is not what I am trying to achieve, I just want to simple URL structure like this:
example.com/post-name.
I want a way so that I can get user request without any need ofindex.php
in the URL.
Thanks, any help will be highly appreciated.
Answer
Solution:
The answer is .htaccess:
See: Redirect everything to index.php