Forum Moderators: phranque
I need a redirect for ID items from a database. The server has been changed from ASP to PHP, along with a new directory system, and the old ASP addresses no longer exist.
I need to redirect:
http://example.com/Directory/search/dispBusiness.asp?BusID=00000
to
http://example.com/component/option,com_mtree/task,viewlink/link_id,00000/Itemid,32/
where 00000 is a variable ID number.
I've torn my hair out trying everything! Can anyone help with this please?
Thanks
[edited by: jdMorgan at 2:17 pm (utc) on Feb. 10, 2009]
[edit reason] please use example.com only [/edit]
So it must be
RewriteEngine On
RewriteCond %{QUERY_STRING} ^BusID=([0-9]+)$
RewriteRule ^/?Directory/search/dispBusiness\.asp\?BusID=([0-9]+)$ http://example.com/component/option,com_mtree/task,viewlink/link_id,$1/Itemid,32/ [R=301,L]
[edited by: wildbest at 12:30 pm (utc) on Feb. 10, 2009]
[edited by: jdMorgan at 2:17 pm (utc) on Feb. 10, 2009]
[edit reason] example.com [/edit]
Try:
RewriteEngine on
#
RewriteCond %{QUERY_STRING} ^BusID=([0-9]+)$
RewriteRule ^/?Directory/search/dispBusiness\.as[b]p$[/b] http://example.com/component/option,com_mtree/task,viewlink/link_id[b],%1/[/b]Itemid,32[b]/?[/b] [R=301,L]
This assumes that the values of "option," "task," and "ItemID" are fixed values based only on the match with the requested URL, because they cannot be derived as variables from that requested URL. For example, the value of "ItemID" in the new URL will always be "32" because the the originally-requested URL carries only "LinkID" as a variable, and does not explicitly contain any information about the ItemID.
Jim