0

I want to make a rewrite module in htaccess file something like below

http://example.com/index.php?tel=604-567-0909&cat=1&sort=2

to

http://example.com/604-567-0909/?cat=1&sort=2

so $_GET will be

$_GET[tel] = 604-567-0909
$_GET[cat] = 1 
$_GET[sort] = 2

How would this rule look like?

Niels
  • 48,601
  • 4
  • 62
  • 81
user1736363
  • 69
  • 1
  • 8

1 Answers1

0

It would look like this if you only wanted to accept numbers and dashes in the tel field:

RewriteRule ^/?([0-9\-]+)/$ index.php?tel=$1 [L]

The other values in the query string would be carried over automatically, and this rule would work without them just fine.

Rudi Visser
  • 21,350
  • 5
  • 71
  • 97