the params is multiple, how to implement the 301 rule
4 posts
• Page 1 of 1
the params is multiple, how to implement the 301 rule
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
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
Re: the params is multiple, how to implement the 301 rule
Please try this:
RewriteCond %{QUERY_STRING} id=(\d+)&name=([^./]+)
RewriteRule index.php /id/%1/name/%2/ [NC,R=301]
RewriteCond %{QUERY_STRING} id=(\d+)&name=([^./]+)
RewriteRule index.php /id/%1/name/%2/ [NC,R=301]
Re: the params is multiple, how to implement the 301 rule
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
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
Re: the params is multiple, how to implement the 301 rule
I try to add the
RewriteCond %{QUERY_STRING} id=(\d+)&([^./]+)
RewriteRule index.php /id/%1?%2 [NC,R=301]
seems I get error url.
RewriteCond %{QUERY_STRING} id=(\d+)&([^./]+)
RewriteRule index.php /id/%1?%2 [NC,R=301]
seems I get error url.
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests