Jump to content

Optimizing SEO urls


zznic

Recommended Posts

I would like to change the way my urls are shown, I'd rather have the name of the product on the url than the codes now showing. I have been through the Admin page and found out that I have first to install .htaccess and then change from no to yes in the Activate URLs for SEO optimization drop down menu. 

 

Now my question is, the shop is on line since quite a long time, can I do it now and is it difficult to do? Will I face any problem at all?

 

Thanks a lot for your kind feeback

 

regards

 

Nicola :-)

Link to comment
Share on other sites

It's easy enough to do, and the htaccess is designed to take care of redirects from the old urls to the new. Be sure to rebuild the caches and create a new sitemap and export your catalog to Google or wherever you send yours.

 

Copy some of the current urls so you can see if they redirect correctly to the seo urls. If not, report back with what the original and the new turned out to be.

 

PS Thank you for providing your setup info in your sig!!

Link to comment
Share on other sites

Thanks a lot for the hints, I already created the .htaccess and I'm going to switch to the SEO Urs. When you say rebuild the caches you mean that I have to mark all four delete cache options, correct? Ciao, Nicola

 

It's easy enough to do, and the htaccess is designed to take care of redirects from the old urls to the new. Be sure to rebuild the caches and create a new sitemap and export your catalog to Google or wherever you send yours.

 

Copy some of the current urls so you can see if they redirect correctly to the seo urls. If not, report back with what the original and the new turned out to be.

 

PS Thank you for providing your setup info in your sig!!

Link to comment
Share on other sites

Looks like I have found an issue on the URLs, for example the word "señuelos" carries the spanish "ñ" and in the url it is replaced by a - sign so it reads se-uelos. I have compared with other spanish webs and the word is writen correctly on the URL. Any idea?

 

thanks, ciao

 

Nicola

Link to comment
Share on other sites

Can you give us an example of a URL (a web address) that contains a diacritical marked character - such as the ñ?

 

All the rules that define how the Internet works state that only ASCII characters are allowed in URLs.

 

(I'm working on a hack that offers translations to the friendly URL part of the whole Search Engine aspect of CubeCart.)

Link to comment
Share on other sites

Interesting about the <title>, it has been my experience that the <title> as shown in the browser window title bar does not show HTML entities as the entity (&nbsp;, for example, will show &nbsp; as opposed to an actual space). But apparently the title bar is UTF-8 compliant.

 

There has been some discussion about making URLs internationally aware, but I am not sure it has been implemented anywhere.

 

Link to comment
Share on other sites

I would add that in our case I have to use Carters, rather than Carter's in the Product Names to keep the url from being carter-s- . I could have edited the SEO urls to take out the hyphen, but I didn't understand that when I started the store.

 

Until recently, thanks to Bsmither's help, I couldn't get Carter's with the apostrophe to work as a search term within the store, so it didn't matter.

 

I just copy/pasted cañas from one of your listings into the Spanish language Search Box, and it didn't find your items. Looks like you're going to have to use Bsmither's tweak of the search code to make your searches work. But that's another matter that should be easy to fix with his tweak.

Link to comment
Share on other sites

Ok, let's resume for the idiot - which is me  obviously - there's not much that I can do with my limited skills and knowledge, I will wait to see if something happens with the Cart updates.

 

Funny, I tried to attach the url of a shop that shows the ñ in the url and once pasted here would turn the ñ into some %& and stuff like this... :-)

 

Thanks again, ciao 

 

Nicola

PD: what shall I do with the cache, delete them all to restore?

Link to comment
Share on other sites

To show the url leave the http:// part off - otherwise the shortening mechanism happens - and to keep the code mess from happening try clicking on the <> up in the editing row just above where we type in the post and put it in there.

 

If that doesn't work, just copy/paste the url and I'll see if I can get it to show.

Link to comment
Share on other sites

Here is what the URL actually looks like:

/es/ca%C3%B1as-pesca-bolo%C3%B1esa

/es/se%C3%B1uelos-artificiales/peces-hart/peces-hart-shore-minnow-125.html

 

The international character is being converted to its URL-encoded UTF-8 two-byte equivalent: %C3%B1

 

Knowing this, we can then convince CubeCart to do the same.

 

(Only very specialized tools will reveal the raw stream of characters. Almost every other inspection tool will "for your convenience" convert a convertible sequence until it can't be converted anymore, that is, by showing the final character.)

Link to comment
Share on other sites

If you are skilled at editing (using a programmer's text editor), in the file /includes/functions.inc.php, find the function sanitizeSEOPath.

 

Replace it completely with:

function sanitizeSEOPath($path) {
    ## Remove extention
    $path = preg_replace("/.w{2,4}$/", '', $path);
    ## Make path lowercase - as much as possible
    $path = mb_strtolower($path);
    ## Encode multi-byte characters (UTF-8)
    $path = implode("/", array_map("rawurlencode", explode("/", $path)));
    ## Allow 0-9, a-z, A-Z, -,_ and / and %
    $path = preg_replace('/[^a-z0-9-_/%]/i', '-', $path);
    ## Remove any odd double dashes
    return str_replace('--', '-', $path);
}
 

(I haven't tried this yet.)

Link to comment
Share on other sites

This routine is called by a function, one of a number of functions that specialize in doing all things necessary to create, put in the database, and recall from the database, the search-engine-friendly URLs. That particular function, setdbPath, has the job of determining if a friendly URL (let's call it a 'path') already exists in the database. And if not already used, the function makes sure the path you want to use conforms to established URL syntax.

 

The routine that makes sure the path conforms to established URL syntax replaces any illegal character with a dash and makes the whole path lower-case. The new code makes one more replacement -- international characters with their URL conforming version.

 

I said I haven't tried it yet because I am in the middle of making some changes to other parts of the code. But I will shortly.

Link to comment
Share on other sites

Make a backup copy of the whole file, includes.inc.php, either in Filemanager within cpanel, or via FTP. Then, if you were to get confused you can always put the original back in quickly, With that done,

 

Go near the end of the file and find this section:

/**
 * Sanitize SEO allowed path
 *
 * @return string
 */
function sanitizeSEOPath($path) {
	## Remove extention
	$path = preg_replace("/.w{2,4}$/", '', $path);
	## Make path lowercase
	$path = strtolower($path);
	## Allow 0-9, a-z, -,_ and /
	$path = preg_replace('/[^a-z0-9-_/]/', '-', $path);
	## Remove any odd double dashes
	return str_replace('--', '-', $path);
}

Replace it with the code Bsmither provided. No need to be concerned - Bsmither knows what he's doing - as long as you have a backup you're safe. He's attempting to change the way in which CC deals with your Spanish characters.
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...