for a multi-site setup we are about to launch a chinese store, which has chinese characters in the base url. Howeverer, using .htaccess to load the correct store view, we receive a "Invalid URI supplied" error log and it also crashes the english view for that store, even though the english view doesn't have any chinese characters in the base_url.
Does anyone know what the problem is?
We are using 1.9.1 CE
Here is what I tried in the htaccess:
EDIT:
I've tried various modules, but all only seem to support url keys for products, categories and cms, but none seemt o address to the base_url issue.
I've tried this module: https://github.com/Minglong/Magento-unicode-URL
and I've also tried this: http://killerwhalesoft.com/blog/magento-unicode-url-key-products-categories-cms-pages/
Sorry, but some recent changes on StackExchange suddenly does not allow me to use chinese characters in the body Body cannot contain -insert-chinese-symbol-
.
Please see this link for full code info ..
Can anyone help identify the error with the above trace? Could the error come from the _checkBaseUrl
function in /core/Mage/Core/Controller/Varien/Front.php
?
EDIT 2:
Ok, so I've tried to analyse the lib/Zend/Uri/Http.php
file and I placed a log output in the valid() function to see which throws the error. According to the log
The error seems to come from the validatePath()
function.
When logging with this function I receive the following:
2015-08-17T08:52:40+00:00 DEBUG (7): path : /-chinese-chars-here-/shop/
2015-08-17T08:52:40+00:00 DEBUG (7): pattern : /^(?:\/(?:(?:%[[:xdigit:]]{2}|[A-Za-z0-9-_.!~*'()\[\]:@&=+$,;])*)?)+$/
2015-08-17T08:52:40+00:00 DEBUG (7): status : 0
So I need to edit the regex values so it allows chinese vars - specifically this part of the __construct() function in Http.php:
const CHAR_ALNUM = 'A-Za-z0-9';
const CHAR_MARK = '-_.!~*\'()\[\]';
const CHAR_RESERVED = ';\/?:@&=+$,';
const CHAR_SEGMENT = ':@&=+$,;';
const CHAR_UNWISE = '{}|\\\\^`';
To make this validation work:
// Escaped special characters (eg. '%25' for '%')
$this->_regex['escaped'] = '%[[:xdigit:]]{2}';
// Unreserved characters
$this->_regex['unreserved'] = '[' . self::CHAR_ALNUM . self::CHAR_MARK . ']';
// Segment can use escaped, unreserved or a set of additional chars
$this->_regex['segment'] = '(?:' . $this->_regex['escaped'] . '|[' .
self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_SEGMENT . '])*';
// Path can be a series of segmets char strings seperated by '/'
$this->_regex['path'] = '(?:\/(?:' . $this->_regex['segment'] . ')?)+';
// URI characters can be escaped, alphanumeric, mark or reserved chars
$this->_regex['uric'] = '(?:' . $this->_regex['escaped'] . '|[' .
self::CHAR_ALNUM . self::CHAR_MARK . self::CHAR_RESERVED .
// If unwise chars are allowed, add them to the URI chars class
(self::$_config['allow_unwise'] ? self::CHAR_UNWISE : '') . '])';