afarazit
afarazit

Reputation: 4984

removing two GET parameters from url using .htaccess

I have a url that looks like this

http://example.com/index.php?con=something&met=meh

What i'm trying to do is get rid of con= and met= so the url would look like

http://example.com/index.php/something/meh

That's what i've done so far

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ action=$1 [L,QSA]
RewriteRule ^(.*)$ page=$1 [L,QSA]

but nothing changes, the url it still look the same http://example.com/index.php?con=something&met=meh

What am i doing wrong?

Upvotes: 0

Views: 1312

Answers (1)

Ravan Scafi
Ravan Scafi

Reputation: 6392

I did like this:

RewriteEngine on
RewriteRule ^index.php/([^/]+)/?([^/]*) /index.php?con=$1&meh=$2 [NC]

Notice that if you don't pass any meh, it still works.

Upvotes: 3

Related Questions