.htaccess - htaccess redirect specific url to another domain -


i want redirect specific url params domain

http://domain.tld/buy/?w=x1234 http://anotherdomain.tld/product.php?id=x1234

here htaccess

rewritecond %{request_uri} !^/*buy/(.*)$ [nc] rewriterule ^/*buy/?w=([a-za-z0-9]+)$ http://anotherdomain.tld/product.php?id=$1 [nc,l,r=301] 

but not working. maybe problem param ?w=

thank you

update: solve problem using query string, after reading how regex , .htaccess rewrite url

rewritecond %{query_string} ^w=([a-za-z0-9]+)$ rewriterule ^/*buy/$ http://anotherdomain.tld/product.php?id=%1 [nc,l,r=301] 

thank stackoverflow , folks! m start understanding regex here ^_^

that's right, params won't picked up, can passed on.

something like;

rewriterule ^buy/([a-za-z0-9]+)$ http://anotherdomain.tld/product.php?id=$1 [nc,l,r=301] 

where original url be; /buy/x1234


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -