Exibel
Exibel

Reputation: 121

Yet another .htaccess victim

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

Answers (1)

Joshua K
Joshua K

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/

works for me :)

Upvotes: 2

Related Questions