× Here you can get community support related to ReDJ.

301 redirect Virtuemart products

  • rasputin73
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 8 months ago #749 by rasputin73
301 redirect Virtuemart products was created by rasputin73
Here is the situation. I'm taking over an online business and need to redirect thousands of products to their new URLs on my page. I am using CSVI to import the products so I can assign the product ID's to be the same number as they were, but when I import the product ID in Virtuemart it strips the preceding zeros.

Example 00123 ---> 123

So, in ReDJ when I create an input of
00123
I need to match it to an output of
{host}/index.php?page=shop.product_details&product_id=123

On the input side I have to be careful because if I remove the zeros there, then a input of 123 would match 123, 1123, 11123, etc...

Basically I need to take any query that ends in xxxxx.html . strip the preceding zeros and try to match with virtuemart product id of ...&product_id=xxxxx

Any help is appreciated

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #750 by admin
Replied by admin on topic 301 redirect Virtuemart products
Hi,
not so clear. Please, provide an example of full OLD and NEW URLs.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • rasputin73
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 8 months ago #752 by rasputin73
Replied by rasputin73 on topic 301 redirect Virtuemart products
ok, this is what the current URL looks like.
www.findcoolclothes.com/00865.html?id=HWks3pgd
The new URL will be
www.findcoolclothes.com/index.php?page=shop.product_details&option=com_virtuemart&flypage=flypage.tpl&product_id=865

The actual product id in the OLD URL is the 5 digit 00865 part. As you can see, the product ID in the new URL is just 865. In addition to that some OLD URLs may have strings of numbers in them that are not product IDs. To validate only product IDs I need to verify that it is a 5 digit number followed by .html . After validating it, I need to remove all preceding zeros.

I've found a regex that will make that match, but Im not sure if lookarounds are supported in ReDJ. (?<!\d)(?=\d{5}\.html)0*(\d+) will match only the 865 part. Perhaps there is an easier way?

Any help is appreciated. I'd be happy to by the Enterprise edition if needed!

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #755 by admin
Replied by admin on topic 301 redirect Virtuemart products
You can do this with ReDJ Enterprise using a single macro (preg_match), but to be honest you can do also with ReDJ Community using two macros. I'm assuming all old URLs start with <article_id>.html, and the id parameter is not mandatory:
From URL: ^/[0-9]{1,5}\.html
To URL: http://{siteurl}/index.php?page=shop.product_details&option=com_virtuemart&flypage=flypage.tpl&product_id=${id}
Request only: true (must be checked)
Macros:
path={path}
id={preg_placeholder 1,path}/\/0*([0-9]+)\.html/{/preg_placeholder}

Tested and working.

Kind regards,
Luigi

Please Log in or Create an account to join the conversation.

  • rasputin73
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 8 months ago #758 by rasputin73
Replied by rasputin73 on topic 301 redirect Virtuemart products
Im using ReDJ Community 1.5.7 on Joomla 1.5.24 . I don't see any options for the last things
Request only: true (must be checked)
Macros:
path={path}
id={preg_placeholder 1,path}/\/0*([0-9]+)\.html/{/preg_placeholder}

What am I missing?

Please Log in or Create an account to join the conversation.

  • rasputin73
  • Topic Author
  • Offline
  • New Member
  • New Member
More
11 years 8 months ago #759 by rasputin73
Replied by rasputin73 on topic 301 redirect Virtuemart products
Here is a screenshot showing the checkboxes and options I have.
Attachments:

Please Log in or Create an account to join the conversation.

Time to create page: 0.270 seconds