0

I want to redirect URL:

prolist.php?id=1297&lang=en 

to that:

details.php?id=1297

But id don't want to redirect other URL's that haven't "lang=en" parameter at the end of URL.

1 Answers1

0

So you want to implement a condition for your redirection ruile that matches a precise pattern against the query string:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=(\d+)&lang=en$
RewriteRule ^/?prolist\.php$ /details.php?id=%1 [QSD,R=301]

And maybe you also want to implement an internal rewrite rule:

RewriteEngine on

RewriteCond %{QUERY_STRING} ^id=(\d+)&lang=en$
RewriteRule ^/?prolist\.php$ /details.php?id=%1 [QSD,L,R=301]

RewriteCond %{QUERY_STRING} ^id=(\d+)$
RewriteRule ^/?details\.php$ /prolist.php?id=%1&lang=en [L]
arkascha
  • 41,620
  • 7
  • 58
  • 90