1

I have a ecommerce site with hundreds of products. I recently changed permalinks and their base. Using Wordpress and Woocommerce plugin, I removed /shop/%product-category% from the URL. However, my old URLs are still active. Check out the following example:

greenenvysupply.com/shop/accessories/gro1-1-3mp-usb-led-digital-microscope-10x-300x/ greenenvysupply.com/gro1-1-3mp-usb-led-digital-microscope-10x-300x/

The first URL is old. Why does it still work? Shouldn't I get a 404 page?

Here is code from page source related to the canonical:

href="https://www.greenenvysupply.com/shop/feed/" />
<link rel='canonical' href='https://www.greenenvysupply.com/gro1-1-3mp-usb-led-digital-microscope-10x-300x/' />

<meta name="description" content="The 1.3 Mega-Pixel USB LED Digital Microscope is great for identifying pests and diseases on your plants so you can accurately resolve the problem."/>
<link rel="canonical" href="https://www.greenenvysupply.com/gro1-1-3mp-usb-led-digital-microscope-10x-300x/" />

Because the old URL is still active and not redirecting, my entire website is being seen as having duplicate content. Google crawlers are not being redirected. Why is the URL with /shop/ in it still active even though I have changed the permalink? There has got to be an easy fix for this.

dnat
  • 65
  • 2
  • 9

1 Answers1

0

A canonical URL or other metadata in your response is not the same as a redirect. To accomplish a redirect, your server needs to return a 3xx status code (typically a 301 or 308 for a permanent move as you have here or a 302 or 307 for a temporary move) and return a "Location" header that indicates the URL to which to redirect. How exactly you make your server do this is dependent on the type of server or server framework that you happen to be using for your website.

How to accomplish a redirect is somewhat independent of your implicit SEO question about whether to prefer a redirect over a canonical URL, which I'm afraid I cannot answer. Regardless of the approach you use, though, you should be aware that search engines -- Google or otherwise -- may not reflect the changes from your website immediately, so don't panic if you don't see the desired search engine change you were looking for immediately following a change to your website.

Michael Aaron Safyan
  • 93,612
  • 16
  • 138
  • 200
  • I have read the putting a redirect in the header.php will work. Any truth to that or any more information you can share? My website is hosted on Bluehost and I have access to the cpanel, I use Woocommerce and a custom Wordpress theme. Thanks! – dnat Sep 05 '15 at 01:39
  • @dnat yes, that's correct. You can use the http_response_code() function to set the response code and the header() function to set arbitrary headers, including the "Location" header. However, you may find the method HttpResponse::redirect() to be a simpler, cleaner way to do both of those operations in a single function call. See: http://php.net/manual/en/httpresponse.redirect.php – Michael Aaron Safyan Sep 05 '15 at 01:42
  • What I should be asking is, why are my old permalinks still active? Every permalink I ever used is active causing Google to see duplicate content. Shouldn't they automatically redirect or give a 404? How can I remove old permalinks? – dnat Sep 05 '15 at 02:54
  • I think the term "active" is a bit confusing here... are you asking why your server still responds at that URL or why Google still shows those URLs in search results? The two are slightly different. For the former, it's because you -- as the webmaster / site owner / etc. -- need to update your server to make it redirect. Simply putting a tag in your page doesn't tell the server to perform a redirect. – Michael Aaron Safyan Sep 05 '15 at 02:58
  • Ok... why don't my permalinks automatically redirect when I change them in wordpress? How come I can still type in the old URL and I get taken to the page WITHOUT the URL changing to the new one. I thought Wordpress did this automatically. Otherwise you're telling me that because I changed the category base in the URL, I am going to have to implement 301s on over 700 product pages. – dnat Sep 05 '15 at 03:13
  • @dnat you'll have to ask the wordpress folks (perhaps there is a way to configure it to redirect when you change the URL?) – Michael Aaron Safyan Sep 05 '15 at 03:19