Redirect disabled product pages

Post Reply
AaronAdkins
Posts: 1
Joined: Wed Aug 17, 2016 4:51 pm

Redirect disabled product pages

Post by AaronAdkins » Wed Aug 17, 2016 4:56 pm

Hi,

I have recently made a new build of a website using opencart. All 301 redirects from the old site are working fine in the .htaccess file.

I now need to disable some of the products on the store, however, I don't want the "product not found" page to be shown & I can't seem to get these pages to redirect to the category page.

For example, I would like www.example.co.uk/category/sub-cat/product-1/ to be redirected to www.example.co.uk/category/sub-cat/ but can't figure out why this isn't redirecting. I thought this could be due to a caching issue but it appears not.

Any help is greatly appreciated. Thank you.

webecho
Posts: 47
Joined: Mon Dec 06, 2010 9:17 am

Re: Redirect disabled product pages

Post by webecho » Mon Jan 23, 2017 4:58 pm

Did you find a solution for this?

User avatar
thekrotek
Posts: 596
Joined: Sun Jul 03, 2016 12:24 am
Contact:

Re: Redirect disabled product pages

Post by thekrotek » Tue Jan 24, 2017 12:56 pm

You can simply replace 'error/not_found' in product controller with 'catalog/category'. Should work.
Image

User avatar
EvolveWebHosting
Posts: 966
Joined: Fri Mar 27, 2015 11:13 pm
Location: Denver, Colorado, USA
Contact:

Re: Redirect disabled product pages

Post by EvolveWebHosting » Wed Jan 25, 2017 7:39 am

thekrotek wrote:You can simply replace 'error/not_found' in product controller with 'catalog/category'. Should work.
This is not a good idea.

Instead, create a 301 redirect in your .htaccess file

User avatar
Johnathan
Global Moderator
Posts: 5856
Joined: Fri Dec 18, 2009 3:08 am
Contact:

Re: Redirect disabled product pages

Post by Johnathan » Wed Jan 25, 2017 11:46 pm

You could do this with Redirect Manager, but you'd need to do it for each URL you want to redirect. If you want something that automatically does it, you'll need a small modification to do that. I actually have this on my list for future extension ideas, but need to finish up a few other projects first.

If you need it immediately, you can probably hire a developer to do this mod for you for not too much. If you need to find a developer, you should post a request in the OpenCart "Commercial Support" forum, which is checked by a number of OpenCart developers. You can also try checking out the OpenCart "Partners" area.
Image
Image Image Image Image Image Image

User avatar
thekrotek
Posts: 596
Joined: Sun Jul 03, 2016 12:24 am
Contact:

Re: Redirect disabled product pages

Post by thekrotek » Thu Jan 26, 2017 6:00 am

EvolveWebHosting wrote:This is not a good idea.

Instead, create a 301 redirect in your .htaccess file
Of course it's not. Why have two-lines VQMod, when you can have a bunch of rules for every disabled product in .htaccess? Let alone the perfect opportunity to edit .htaccess again, when disabled product becomes available! Mmm...

In this particular controller visitor is redirected to 'error/not_found' page exactly, when product is not found (disabled). There's absolutely no reason to have an extension to do such simple task. Either edit file directly or create a VQMod, which will inject one super simple replacement.
Image

Post Reply

Return to “Security & Server”

Who is online

Users browsing this forum: No registered users and 8 guests