0

I've a live url some thing like this,

http://example.com/today.php?year=2012&date=24&mon=07

and i want it to redirected to

http://example.com/holiday-today/year/mon/date

I tried with %{QUERY_STRING} but i dont know how to get three query parameters and pass them to the redirected url.

How can i do this using htacess?

Vijay
  • 5,331
  • 10
  • 54
  • 88

2 Answers2

1

I would reference these similar questions with great answers:

Query string redirection with htaccess

301 redirect from URL with query string to new domain with different query string

Community
  • 1
  • 1
Matty B
  • 1,008
  • 2
  • 13
  • 25
1

Try adding this in the htaccess file in your document root:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /today\.php\?year=([0-9]+)&date=([0-9]+)&mon=([0-9]+)
RewriteRule ^today\.php$ /holiday-today/%1/%2/%3? [R=301]
Jon Lin
  • 142,182
  • 29
  • 220
  • 220