Reputation: 121
I am sorry if this is a really simple question, but I have not found out how to do it. How the .htaccess file work is something I never understood.
I have the url:
localhost/[multiple different files.php]
And I want the simple remove the php suffix and add a trail slash. But I also have some pages where the get parameter i is used, eg: localhost/profile.php?i=1
Here I want it to be: localhost/profile/1
So if anyone could help me with this .htaccess-hell, I would be forever thankfull :)
Upvotes: 1
Views: 53
Reputation: 2537
RewriteEngine On
RewriteRule ^([^/]+)/(\d+)$ $1.php?i=$2 [QAS,L]
RewriteRule ^([^/]+)/$ $1.php [QAS,L]
something like that?
to test it: http://htaccess.madewithlove.be/
type in the first field: http://localhost/profile/1
copy the code from above inside the big field.
click "Check now"
works for me :)
Upvotes: 2