the params is multiple, how to implement the 301 rule

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 13
Joined: 21 May 2015, 17:54

the params is multiple, how to implement the 301 rule

03 Dec 2015, 08:29

Original URL:

http://example.com/index.php?id=1234&na ... ward-Smith
Desired rewritten URL

http://example.com/id/1234/name/John-Edward-Smith
My current .htaccess:

RewriteEngine On
RewriteRule ^id/(\d+)/name/([^./]+)$ index.php?id=$1&name=$2 [NC,L]

I want to know how to implement a rule for 301 from original to Desired rewritten URL?
http://example.com/index.php?id=1234&na ... ward-Smith
301 to
http://example.com/id/1234/name/John-Edward-Smith

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: the params is multiple, how to implement the 301 rule

03 Dec 2015, 08:36

Please try this:

RewriteCond %{QUERY_STRING} id=(\d+)&name=([^./]+)
RewriteRule index.php /id/%1/name/%2/ [NC,R=301]

User avatar
Posts: 7
Joined: 16 Oct 2015, 03:30

Re: the params is multiple, how to implement the 301 rule

29 Jan 2016, 04:27

Hi Yaroslav,
can I replace one param, and keep others?
e.g.
http://example.com/index.php?id=1234&na ... &dept=tech

Desired rewritten URL
http://example.com/id/1234?name=ward-Smith&dept=tech

User avatar
Posts: 7
Joined: 16 Oct 2015, 03:30

Re: the params is multiple, how to implement the 301 rule

29 Jan 2016, 04:59

I try to add the
RewriteCond %{QUERY_STRING} id=(\d+)&([^./]+)
RewriteRule index.php /id/%1?%2 [NC,R=301]

seems I get error url.

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 21 guests