1

After a long search through all actions and filters. I was unable to find a url intercepting hook. To put in the function.php in my plugin.

Is there a way to catch all urls that go to my webpage, and has this kind of directory: www.webpage.com/product/number-and-name-product. Intercept thist url and lead to a wordpress page.

more info: I have made a plug-in to make a catalog to show all products with a shortcode on a wordpress page. now i only need to click the product and go to a detail page with the old url here is where i get confused. if i make a second page in wordpress i dont get the url right.

thanks in advance

2
  • I'm very confused by your question. Do you mean if anyone goes to www.webpage.com/product/number-and-name-product they should be redirected to another url?
    – danbrellis
    Mar 24, 2017 at 12:58
  • I have a old webpage with QR codes to that path, and i am making a new site. how do i reuse this url in my plug in code.
    – Kevinco
    Mar 24, 2017 at 13:19

2 Answers 2

0

If you're not comfortable editing/don't have access to your .htaccess file, a plugin called "Redirection" should serve your purpose: https://wordpress.org/plugins/redirection/

5
  • Yes, danbrellis this would help me. Only thing i dont understand is how to make a detail page with this url webpage.com/product/detailpage with a shortcode. how doe you fix that.
    – Kevinco
    Mar 25, 2017 at 11:08
  • what do you mean by "with a shortcode"?
    – danbrellis
    Mar 25, 2017 at 19:11
  • If you click on a product in catalog view (what i already have fixed with a shortcode from a home made plugin) the user must go to a detail page of that product. Is it wise to make this page in a wordpress page with a also a shortcode. Or rather in the plugin itself a page to get this url www.webpage.com/product/number-and-name-product. The question is what is the right way to achieve this
    – Kevinco
    Mar 27, 2017 at 7:22
  • if I understand you correctly, I would recommend just using the Redirection plugin to add all the old product pages and put where they should be redirected to. You can do this at /wp-admin/tools.php?page=redirection.php
    – danbrellis
    Mar 27, 2017 at 14:07
  • I'm partly helped, redirect is a good answer for the old urls. The second part of the question is how i make a detail page within a shortcode, when I click on a product in catalog view. my sec question feels a bit off topic. thanks for the good help @WebElaine danbrellis with redirect the old links the correct way :D
    – Kevinco
    Mar 27, 2017 at 14:37
0

If I understand correctly, you want to capture old URLs that would normally return a 404 error, and redirect them to the new pages on your WordPress site.

If that's the case, it would be simplest to edit your .htaccess file and add redirects there, rather than creating a plugin.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.