MultiDev
MultiDev

Reputation: 10649

Use .htaccess to rewrite URL with GET variables

I would like to make my url of:

example.com/index.php?this=a&that=b

to:

example.com/index.php/a/b

So that whenever somebody visits this page directly:

example.com/index.php/a/b

It will display in the address bar as typed, but will render the content for:

example.com/index.php?this=a&that=b

How is that done?

Upvotes: 0

Views: 28

Answers (1)

Croises
Croises

Reputation: 18671

You can use that in your .htaccess:

RewriteEngine on 
RewriteRule ^index\.php/([^/]+?)/(.+)/?$ index.php?this=$1&that=$2 [L,NC]

Upvotes: 1

Related Questions