I just upgraded a site from 1.3.5 sp3 to 2.1.4 and am having some problems with the links.
I don’t remember when, but CS-Cart decided to quit using target and go with dispatch.
The old links are like:
index.php?target=categories&category_id=3
```<br />
<br />
And they need to be:<br />
<br />
```php
index.php?dispatch=categories&category_id=3
```<br />
<br />
I know there was a fix in the bug tracker that made it so both methods can work, but for the life of me, I can't find it.<br />
<br />
I also can't seem to find it on the forum.<br />
<br />
Apparently, my searching skills are broken today.<br />
<br />
If anyone can help me with this, I'd really appreciate it.<br />
<br />
Thanks,<br />
<br />
Brandon
Hello Brandon,
Unfortunately, there is no such a fix in the standard CS-Cart installation. You can only use “dispatch” links in your store. I can suggest using the following redirect solution,namely, when you open old links, you will be redirected to the site with new links:
- Open the “index.php” file located in the root directory of your CS-Cart installation.
- Add this part of the code:
//[nastena]
if (strpos($_SERVER['REQUEST_URI'], 'target=products')) {
$request_uri = str_replace('target=products', 'dispatch=products.view', $_SERVER['REQUEST_URI']);
$redirect = $config['http_host'] ;
fn_redirect($redirect);
}
if (strpos($_SERVER['REQUEST_URI'], 'target=categories')) {
$request_uri = str_replace('target=categories', 'dispatch=categories.view', $_SERVER['REQUEST_URI']);
$redirect = $config['http_host'] ;
fn_redirect($redirect);
}
//[/nastena]
above this one:
fn_dispatch();
3) Save the file.
—
Anastasiya Kozlova
CS-Cart Support team
Thank you for your help, but unfortunately that doesn’t seem to fully work.
Now when I go to an old link I’m redirected to the home page. This is fine and all, but I’d really rather be directed to the new link.
I’ve tried this with the SEO addon off and on and got the same results.
One thing though, I’ve tried doing a similar thing with 301 redirects in the .htaccess and those don’t seem to do it either. Could there be a server setting that is blocking redirects?
Thanks,
Brandon
Thank you for the reply, Brandon.
The problem requires the investigation on your server. Please contact us via Customer Help Desk and provide us with a temporary access to your server.
—
Anastasiya Kozlova
CS-Cart Support team