Jump to content

Multistore - change 302 redirects to 301


DelaneySecure

Recommended Posts

We have successfully setup the multi-store setting with 2 urls to one store. One store, 2 urls for that store (one main url) using the standard Prestashop 1.5 multistore capability.

 

The issue we have is that when we test the secondary url (www.biometricdirect.net.) redirect it shows as 302, and the SEO company wants it as 301.

 

I've reviewed the logic in /classes/shop/shop.php (about line 333) and its suggests 301 redirect, but is actually recorded as 302.

 

// If an URL was found but is not the main URL, redirect to main URL

if ($id_shop && !$is_main_uri)

{

foreach ($results as $row)

{

if ($row['id_shop'] == $id_shop && $row['main'])

{

// extract url parameters

$request_uri = substr($request_uri, strlen($found_uri));

$url = str_replace('//', '/', $row['domain'].$row['uri'].$request_uri);

header('HTTP/1.1 301 Moved Permanently');

header('Cache-Control: no-cache');

header('location: http://'.$url);

exit;

}

}

}

 

I've seen the suggested hacks in the .htaccess for manual redirects, but was wondering is there is a bit of code logic where the multistore secondary urls could be flagged as 301 redirects (rather than the default 302)?

Link to comment
Share on other sites

  • 1 month later...

First off, htaccess redirects are not a 'hack', they are the preferred method in all honesty.

Secondly, i'd be doing this at the server level (via domain parking and htaccess), and not via prestashop. I have no idea why prestashop insist on implementing domain parking into their system, but its best bypassed and done before prestashop has chance to get its hands on the domain control....

 

Prestashop developers seem to have little concept of good SEO implementation, as their canonical feature (if they can call it that) in 1.4 showed only too well. I'm guessing the 302 problem you are seeing is further evidence of that.

Edited by adibranch (see edit history)
Link to comment
Share on other sites

two urls for one store...

 

a 301 redirect does not allow you to have one(1) content with 2 different url's from an SEO persepective...if that was what you were hoping, then you should revisit that idea...this is reason to do this would be if both urls are gTLD's.

 

if one is a gTLD and other(s) ccTLD's), then you want to preserve the url through the content...and that is how your accomplish SEO by multiplexing your shop's content without duplicate content penalty.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...