// Add support of UTF-8 in multishop virtual uri
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13688 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+1
-1
@@ -1617,7 +1617,7 @@ class ToolsCore
|
|||||||
if ($uri['virtual'])
|
if ($uri['virtual'])
|
||||||
{
|
{
|
||||||
fwrite($write_fd, 'RewriteCond %{HTTP_HOST} ^'.$domain.'$'."\n");
|
fwrite($write_fd, 'RewriteCond %{HTTP_HOST} ^'.$domain.'$'."\n");
|
||||||
fwrite($write_fd, 'RewriteRule ^'.trim($uri['virtual'], '/').'$ '.$uri['physical'].$uri['virtual']."index.php [L,R]\n");
|
fwrite($write_fd, 'RewriteRule ^'.trim($uri['virtual'], '/').'/?$ '.$uri['physical'].$uri['virtual']."index.php [L,R]\n");
|
||||||
fwrite($write_fd, 'RewriteRule ^'.ltrim($uri['virtual'], '/').'(.*) '.$uri['physical']."$1 [L]\n\n");
|
fwrite($write_fd, 'RewriteRule ^'.ltrim($uri['virtual'], '/').'(.*) '.$uri['physical']."$1 [L]\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -254,11 +254,12 @@ class ShopCore extends ObjectModel
|
|||||||
|
|
||||||
$id_shop = '';
|
$id_shop = '';
|
||||||
$found_uri = '';
|
$found_uri = '';
|
||||||
|
$request_uri = rawurldecode($_SERVER['REQUEST_URI']);
|
||||||
if ($results = Db::getInstance()->executeS($sql))
|
if ($results = Db::getInstance()->executeS($sql))
|
||||||
foreach ($results as $row)
|
foreach ($results as $row)
|
||||||
{
|
{
|
||||||
// An URL matching current shop was found
|
// An URL matching current shop was found
|
||||||
if (!$id_shop && preg_match('#^'.preg_quote($row['uri'], '#').'#', $_SERVER['REQUEST_URI']))
|
if (!$id_shop && preg_match('#^'.preg_quote($row['uri'], '#').'#', $request_uri))
|
||||||
{
|
{
|
||||||
$id_shop = $row['id_shop'];
|
$id_shop = $row['id_shop'];
|
||||||
$found_uri = $row['uri'];
|
$found_uri = $row['uri'];
|
||||||
@@ -270,7 +271,7 @@ class ShopCore extends ObjectModel
|
|||||||
else if ($id_shop && $row['main'])
|
else if ($id_shop && $row['main'])
|
||||||
{
|
{
|
||||||
// If an URL was found but is not current URL, redirect to main URL
|
// If an URL was found but is not current URL, redirect to main URL
|
||||||
$request_uri = substr($_SERVER['REQUEST_URI'], strlen($found_uri));
|
$request_uri = substr($request_uri, strlen($found_uri));
|
||||||
header('HTTP/1.1 301 Moved Permanently');
|
header('HTTP/1.1 301 Moved Permanently');
|
||||||
header('Cache-Control: no-cache');
|
header('Cache-Control: no-cache');
|
||||||
header('location: http://'.$row['domain'].$row['uri'].$request_uri);
|
header('location: http://'.$row['domain'].$row['uri'].$request_uri);
|
||||||
|
|||||||
Reference in New Issue
Block a user