So I have my PHP page page.php with the parameter id for example.
Everything works as expected when I visit
page.php?id=1
What I try to do now basically is, reach the site when the user visits
page/1
I’ve looked at countless questions and websites about htaccess rewrites and so on, but I’m not even entirely sure if I need that. I did the exact same thing in an old project of mine where I can’t find any htaccess file, but I also have no idea what I really did.
And in case I do need the htaccess file. How do I ensure that it works properly?
Advertisement
Answer
Alright, gotta put this in the htaccess
RewriteEngine On RewriteRule ^page/([^/]*)$ /page.php?id=$1 [QSA,L]