tags:

views:

20

answers:

1

How would I do this?

A: 

Try this mod_rewrite rule:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^a=(\d+)&b=(\d+)$
RewriteRule ^index\.php$ %1/%2

This will rewrite a request of /index.php?a=6&b=3 internally to /6/3.

And if you rather want the other way round:

RewriteEngine on
RewriteRule ^(\d+)/(\d+)$ index.php?a=$1&b=$2

This will rewrite a request of /6/3 internally to /index.php?a=6&b=3.

Gumbo
Note that you need to have `mod_rewrite` enabled on you Apache installation. It's not turned on per default, but it is a common module.
troelskn
Nice, thanks! :D
Johannes Jensen
How would I make it so that it ONLY does it if I'm on index.php? Like, so it won't mess up my directories?
Johannes Jensen
Which one are you using, the first or the second?
El Yobo
El Yobo
For the second, you would have to change the address slightly, so instead of requesting /6/3 you would request /some_unique_name/6/3, where some_unique_name is some appropriate name that doesn't match your directories. The condition would then be "RewriteCond %{REQUEST_URI} ^/some_unique_name/(\d+)/(\d+)$"
El Yobo
Ah, thanks El Yobo. xD !
Johannes Jensen