Jump to content

saurabh22

Recommended Posts

Hi,

i am cubecart developer, i have recently upgrade my cubecart 3.0 to cubecart 5.2.10

i am using seo friendly URL in my site but i can still open same link by custom url. 

 

https://hindikaraokeshop.com/songs-by-year/2000-s.html

https://hindikaraokeshop.com/index.php?act=viewCat&catId=15

 

above both links are referring to same page. i want that anyone open 2nd link so it must redirect to 1st link or url should be seo friendly.

Two url for same page is creating problem for SEO. 

please help me,

Thanks in advance. 

 

Link to comment
Share on other sites

Hi

No problem for seo, as all links generated on your website are seo friendly now. So there is no links to "OLD" urls. If there is no links to it, google can't get to it.

Besides, this is a red herring that two links can cause the problem. But anyways, from now on spiders will automatically update their links to seo friendly urls and will drop your old links over the next few weeks. Nothing to worry about.

 

regards,

Peter

Link to comment
Share on other sites

There is no need to do this, the old urls do not exist anywhere on the website any more. They are hidden from now on. Seriously do not worry about this.

Unless you want to do it for the sake of it than use 301 redirect for every old page to new seo friendly url. But you might end up with redirect loop in some instances so I would leave it and let spiders do their job.

 

Regards,

Peter

Link to comment
Share on other sites

Welcome saurabh22! Glad to see you made it to the forums.

 

I just tested CC5212 and the behavior is as follows:

A request for:

www.store.com/index.php?_a=product&product_id=7

will have CC5 test to see if SEO URL mode is enabled. If SEO URL mode is enabled, then a seo_path for that product will be fetched from the database. If no seo_path yet exists for that product, then CC5 will make a default seo_path. That seo_path will be used to contruct a full seo_url. Then CC5 will execute this statement:

header('Location: '.$seo_url, true, 301);

The browser will then request:

www.store.com/product-7.html

 

If you have a browser utility that can monitor the requests and responses the browser makes and receives, you will see that the browser does receive a 301 Moved Permanently for page requests made the non-seo style URI to the seo-friendly URL.

 

If you do not see this happening, then we need to check that your CC5 store is in SEO URL mode.

Link to comment
Share on other sites

Actually ...

one thing which should be included for all such issues per Google is actually a canonical link tag which identifies WHICH URL Google should use for SERPS, and indexing, regardless of 301/302 redirects, etc.

 

I would highly suggest Al should add the canonical meta tag to store pages which identifies the defacto official URL for the page for search engines.

Link to comment
Share on other sites

Hmmmm.... I'm using the vector theme, and I don't see the canonical tags on any of our store pages and still on 5.2.10 (I looked before I posted, obviously). I will have to look at one of the stock themes to see if the field is there and not automatically written to the head by the store. Presumably this is a hard coded element pulling the pretty permalink out of the dbase, so I could likely simply drop that into the vector skin head area. I will have to look at that tomorrow :-)

 

In any case the canonical link in the meta data would solve any concern about long pretty permalink, short code link, redirect link on title change and rebuild links etc., as the tag identifies which of ANY URL inbound for that page should be treated by Google as the ONLY link for the page.

Link to comment
Share on other sites

ah yes.... you are correct the canonical link is in there

<link rel="canonical" href="{$CANONICAL}" />

FYI, for those using vector, the main.php template has this, which likely needs to be swapped out

<link rel="canonical" href="{$VAL_SELF}" />

for CC 5.2.10 or greater

<link rel="canonical" href="{$CANONICAL}" />

Link to comment
Share on other sites

We deal with SEO every day, but our shopping cart is part of our site, not the entire site. And yes, SEO is super important for Google showing your store products in SERPS, having your site rank well under what you're selling, and even your brand name.

Google has a free basic guide to SEO as a PDF, which I think I linked here before (search forum or Google) which outlines the basic best practices for SEO.

And you should be setting your industry settings for your store in the store admin per product, having SEO friendly titles and descriptions, and submitting your sitemap to your Google Webmaster Account which can show you problems, most popular pages, inbound links, problems with pages, and which pages are being properly indexed.

Most of you already know that, I'm sure, but just a refresher for anybody on this topic :-)

And since Google hates duplicate content, stuff like the canonical page is important if you have both pretty permalinks as they are called along with shortcodes to the page, or change the links to existing pages in some way. Google needs to know which ONE version of the page is the official and ignore the others (duplicates). Google will actually warn you about duplicate pages in your webmaster tools account.

Link to comment
Share on other sites

  • 4 weeks later...

From post #5:

That seo_path will be used to contruct a full seo_url. Then CC5 will execute this statement: header('Location: '.$seo_url, true, 301);

 

I am saying there is no edit to a file you need to do as Cubecart already does this for you.

 

In post #13, you say:

"I am already using <link rel="canonical" href="{$CANONICAL}" /> but I do not get the exact result I need."

 

If you have edited the skin template to change what was being used, {$VAL_SELF}, to the new variable {$CANONICAL}, please be aware that using {$CANONICAL} (a template variable) does not automagically find the value for that variable. We must also change the code that assigns a value to that variable.

 

The statement that assigns a value to CANONICAL shows up in CC529. In the file /classes/gui.class.php, near line 210:

In CC528 and earlier:
        $GLOBALS['smarty']->assign('VAL_SELF',        currentPage());
        $GLOBALS['smarty']->assign('STORE_URL',     $GLOBALS['storeURL']);
 
In CC529 and later:
        $GLOBALS['smarty']->assign('VAL_SELF',        currentPage());
        $GLOBALS['smarty']->assign('CANONICAL',      currentPage(array('sort'), null, false));
        $GLOBALS['smarty']->assign('STORE_URL',     $GLOBALS['storeURL']);
Link to comment
Share on other sites

Hi Bismither,

i am not getting exactly what you are saying. i have checked gui.class.php file but it is same as above.

by using this my problem will not get solve so please tell me the code or way for this -

https://hindikaraoke...ear/2000-s.html

https://hindikaraoke...iewCat&catId=15

 

above both links are referring to same page. i want that anyone open 2nd link so it must redirect to 1st link

Link to comment
Share on other sites

The second URL:

/index.php?act=viewCat&catId=15

is a CubeCart 3 style of standard URL.

 

There is code in the file ini.inc.php that converts those GET key/value pairs to CubeCart 5 style of GET key/value pairs..

 

However, SEO->_construct(), which is responsible for bouncing the browser to an seo-friendly URL, is relying on SERVER['REQUEST_URI'].

 

We can make this upgrade-safe and more generalized, but for now, let's try the following. In ini.inc.php, make this edit near line 180:

Was:
// v3 compatible links
if(isset($_GET['act'])) {
    switch($_GET['act']) {
        case "viewDoc":
            $_GET['_a'] = 'document';
            $_GET['doc_id'] = (int)$_GET['docId'];
        break;
        case "viewCat":
            $_GET['_a'] = 'category';
            $_GET['cat_id'] = (int)$_GET['catId'];
        break;
        case "viewProd":
            $_GET['_a'] = 'product';
            $_GET['product_id'] = (int)$_GET['productId'];
        break;
    }
}
 
Now:
// v3 compatible links
if(isset($_GET['act'])) {
    switch($_GET['act']) {
        case "viewDoc":
            $_GET['_a'] = 'document';
            $_GET['doc_id'] = (int)$_GET['docId'];
            $_SERVER['REQUEST_URI'] = "index.php?_a=document&doc_id=".(int)$_GET['docId'];
        break;
        case "viewCat":
            $_GET['_a'] = 'category';
            $_GET['cat_id'] = (int)$_GET['catId'];
            $_SERVER['REQUEST_URI'] = "index.php?_a=category&cat_id=".(int)$_GET['catId'];
        break;
        case "viewProd":
            $_GET['_a'] = 'product';
            $_GET['product_id'] = (int)$_GET['productId'];
            $_SERVER['REQUEST_URI'] = "index.php?_a=product&product_id=".(int)$_GET['productId'];
        break;
    }
}
 
Link to comment
Share on other sites

Hi Bsmither,

 

Thank you very much, this code is very very helpful to me. thanks a lot again.


i need one more help from you.

https://hindikaraokeshop.com/index.php?sdassdadasd2343444prodsd=879645

i would like to redirect this URL to home page or 404 page.

because this url is not correct bit still homepage is opening with this URL.

 

Thanks in advance :)

Link to comment
Share on other sites

You say this url is not correct - you can get Google to stop looking for it by going to Google Webmaster Tools>your store domain>Google Index>Remove URLS. And you should be able to add a Deny to your robots file to stop all robots from seeing it.

 

I don't know how, but somebody is bound to be along with some way to redirect it in .htaccess or maybe with some CC code.

Link to comment
Share on other sites

"i would like to redirect this URL to home page..."

 

If CubeCart does not understand a querystring (the part after the ?), CubeCart will deliver the homepage.

 

"because this url is not correct bit still homepage is opening with this URL."

 

But this is what you just said you wanted.

 

I can type anything as a querystring: ?hummahummadingaling=whoopwhoopdeedoo and as long as CubeCart has no code that will understand that, CubeCart delivers the homepage.

 

It is your browser (and this is supposed to be how it works) that holds onto the URL as you typed it in.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...