Home htaccess redirect regex w/parameter
Reply: 1

htaccess redirect regex w/parameter

M Holland
1#
M Holland Published in 2018-02-12 16:50:07Z

I would like to do a redirect using htaccess.

http://www.example.com/design-guide/item-information.php?Part-No=8341-02    

To

http://www.example.com/catalog/?page=product&id=guden-8341-02

I can't get this to work at all. Help!

starkeen
2#
starkeen Reply to 2018-02-12 17:49:50Z

You can use the following Rule in your htaccess

RewriteEngine on

RewriteCond %{THE_REQUEST} /design-guide/item-information\.php\?Part-No=8341-02 [NC]
RewriteRule ^ http: //www.example.com/catalog/?page=product&id=guden-8341-02 [L,R]

If 8341-02 is a dynamic value and you want to append it to the destination url,use this instead :

 RewriteEngine on

RewriteCond %{THE_REQUEST} /design-guide/item-information\.php\?Part-No=([^\s]+) [NC]
RewriteRule ^ http: //www.example.com/catalog/?page=product&id=guden-%1 [L,R]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.353341 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO