Jump to content

Change how SEO URLs generate?


StreamAlex

Recommended Posts

I use Swedish as language and when I use the letters Ã¥ (å), ä (ä) and ö (ö) in the product and category names they get replaced with a hyphen (-) in the URLs. I want them to be replaced with the letters "a" and "o" instead. How do I fix this?

 

I use latest version of CubeCart.

Link to comment
Share on other sites

Hi Alex,

 

This has been an issue for a while as the default PHP code to allow "a-z" doesn't include "special characters" like the ones you mention so there is no automated way we can sanitize this keeping such characters... 

 

If you open includes/functions.inc.php remove at around line 723:

$path = preg_replace('/[^a-z0-9-_/]/', '-', $path);

It will then stop replacing characters other than a-z 0-9 '-' and '/' with a hyphen and it will accept your paths. 

Link to comment
Share on other sites

I did some work on that and my solution was to permit % as a legal character.

 

I believe "special" characters are essentially disallowed as characters in a URL path. It will be real tricky as such characters may get translated into their hex code equivalent. Will it be the single byte upper-ascii or the 2,3-byte UTF-8?

 

In the end of my experiments, my 'legal' URL is the result of rawurlencode($path) which converts the UTF-8 upper bytes to, for example, %C0%56.

 

This gets databased safely, and mostly survives getting clicked on as a link.

 

The goal is to have the database CC_seo_paths table have a match against what the querystring 'seo_path' comes in as.

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...