The site has multiple langs and different domains for them:
en lang: https://hello-park.com
ru lang: https://hello-park.ru
I have the problem with redirects inside site panel, it happen when I click on other tabs:
Everything works fine (other pages in the panel):
https://hello-park.com/panel/site
https://hello-park.com/panel/pages/riviera?language=en
https://hello-park.com/panel/system?language=en
etc.
The tab’s URL is correct:
https://hello-park**.com**/panel/site/?tab=settings&language=en
But for some reason it redirect to
https://hello-park**.ru**/panel/site?tab=settings&language=en
Why it could be? How can I fix it, to be able to get all panel’s content from different domains (.com/.ru)?
site/config/config.php
<?php
header('Access-Control-Allow-Origin: *');
return [
'debug' => true,
'kirbytext.image.figure' => false,
'languages' => true,
'languages.detect' => false,
'date.handler' => 'strftime',
'locale' => 'ru_RU.UTF-8',
'bvdputte.fingerprint.parameter' => true,
'sylvainjule.bouncer.list' => [
'city' => [
'fieldname' => 'canaccess',
]
],
'bnomei.janitor.jobs' => [
'cleanAmoToken' => function ($page = null, $data = null) {
$tmpDir = kirby()->root('plugins').'/contactform/vendor/megalaner/src/tmp';
if(Dir::exists($tmpDir)) {
Dir::remove($tmpDir);
return [
'status' => 200,
'label' => 'Токен удален',
];
} else {
return [
'status' => 400,
'label' => 'Токен не установлен',
];
}
}
],
'routes' => [
[
'pattern' => ['/'],
'action' => function () {
$url = 'https://' . $_SERVER['SERVER_NAME'];
$tmp = explode(".", parse_url($url, PHP_URL_HOST));
$domain = end($tmp);
switch ($domain):
case 'com.br':
go('https://hello-park.com.br/saopaulo/main'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'br':
go('https://hello-park.com.br/saopaulo/main'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'lt':
go('https://hellopark.lt/kaunas/main'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'lt':
go('https://hello-park.lt/kaunas/main'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'co':
go('https://hello-park.co/es/bogota/main'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'ru':
go('https://hello-park.ru/select'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'kz':
go('https://hello-park.ru/select'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
case 'com':
go('https://hello-park.com/select'.($_SERVER['QUERY_STRING'] ? '?'.$_SERVER['QUERY_STRING']:''), 301);
break;
default:
go('/select', 301);
endswitch;
}
],
[
'pattern' => '(:any)',
'language' => '*',
'action' => function ($language, $slug) {
$page = page($slug);
if($page && $page->template() == 'city') {
return go($page->children()->template('main')->nth(0)->url(), 301);
} else if ($page && $page->template() == 'city-external') {
return go($page->link());
}
return $page;
}
]
]
];
site/languages/en.php
<?php
return [
'code' => 'en',
'default' => true,
'direction' => 'ltr',
'locale' => [
'LC_ALL' => 'en'
],
'name' => 'English',
'translations' => [
'orderPart' => 'Order a party',
'buyTickt' => 'To buy a ticket',
],
'url' => 'https://hello-park.com'
];
site/languages/ru.php
<?php
return [
'code' => 'ru',
'default' => false,
'direction' => 'ltr',
'locale' => [
'LC_ALL' => 'ru'
],
'name' => 'Русский',
'translations' => [
'orderPart' => 'Праздники',
'buyTickt' => 'Купить билет',
],
'url' => 'https://hello-park.ru'
];
.htaccess
# Kirby .htaccess
# revision 2020-06-15
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ https://hello-park\.ru/$1 [R=301,L]
RewriteCond %{REQUEST_URI} ^/(start|projects|exhibitions|attractions|news|business-tilda).* [NC]
RewriteCond %{HTTP_HOST} ^hello-park\.com$ [NC]
RewriteRule (.*) http://hello-park.io/en/$1 [L,NC,R=301]
RewriteCond %{REQUEST_URI} ^/(start|projects|exhibitions|attractions|news|business-tilda).* [NC]
RewriteCond %{HTTP_HOST} ^hello-park\.ru$ [NC]
RewriteRule (.*) http://hello-park.io/$1 [L,NC,R=301]
RewriteCond %{HTTP_HOST} ^hellopark\.ru$ [NC]
RewriteRule ^(.*)$ https://hello-park\.ru/$1 [L,R=301]
# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder;
# otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite,
# set the RewriteBase to:
#
# RewriteBase /mysite
# In some environments it's necessary to
# set the RewriteBase to:
#
# RewriteBase /hello-park-b2c
# block files and folders beginning with a dot, such as .git
# except for the .well-known folder, which is used for Let's Encrypt and security.txt
RewriteRule (^|/)\.(?!well-known\/) index.php [L]
# block all files in the content folder from being accessed directly
RewriteRule ^content/(.*) index.php [L]
# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]
# block direct access to Kirby and the Panel sources
RewriteRule ^kirby/(.*) index.php [L]
# Bust browsercache on CSS & JS files
# More info: https://github.com/bvdputte/kirby-fingerprint
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.([0-9a-z]{32})\.(js|css|png|jpe?g|gif|svg|ico)$ $1.$3 [L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
# Bust browsercache on CSS & JS files
# More info: https://github.com/bvdputte/kirby-fingerprint
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.([0-9a-z]{32})\.(js|css|png|jpe?g|gif|svg|ico)$ $1.$3 [L]
</IfModule>
# pass the Authorization header to PHP
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/
#
<IfModule mod_deflate.c>
# Insert filters / compress text, html, javascript, css, xml:
# mod_deflate can be used for Apache v2 and later and is the recommended GZip mechanism to use
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/vtt
AddOutputFilterByType DEFLATE text/x-component
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/js
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/atom+xml
AddOutputFilterByType DEFLATE application/json
AddOutputFilterByType DEFLATE application/ld+json
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/font-sfnt
AddOutputFilterByType DEFLATE application/x-web-app-manifest+json
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/sfnt
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
# Exception: Images
SetEnvIfNoCase REQUEST_URI \.(?:gif|jpg|jpeg|png)$ no-gzip dont-vary
# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Make sure proxies don't deliver the wrong content
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
# mod_gzip is an external extension and last updated 2015, so
# if available please use mod_deflate instead
# If you are stuck on Apache v1.3 you can use mod_zip to enable Gzip
# as mod_deflate is available for Apache v2 or later only.
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 week"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/atom+xml "access plus 1 hour"
ExpiresByType application/rdf+xml "access plus 1 hour"
ExpiresByType application/rss+xml "access plus 1 hour"
ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/ld+json "access plus 0 seconds"
ExpiresByType application/schema+json "access plus 0 seconds"
ExpiresByType application/vnd.geo+json "access plus 0 seconds"
ExpiresByType application/xml "access plus 0 seconds"
ExpiresByType text/xml "access plus 0 seconds"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType image/vnd.microsoft.icon "access plus 1 month"
#ExpiresByType text/html "access plus 1 minute"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 months"
ExpiresByType application/x-javascript "access plus 1 months"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/svg+xml "access plus 1 month"
ExpiresByType image/bmp "access plus 1 month"
ExpiresByType image/webp "access plus 1 month"
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType video/mp4 "access plus 1 month"
ExpiresByType video/ogg "access plus 1 month"
ExpiresByType video/webm "access plus 1 month"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType text/x-component "access plus 1 month"
ExpiresByType application/manifest+json "access plus 1 week"
ExpiresByType application/x-web-app-manifest+json "access plus 0 seconds"
ExpiresByType text/cache-manifest "access plus 0 seconds"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
ExpiresByType font/eot "access plus 1 month"
ExpiresByType font/opentype "access plus 1 month"
ExpiresByType application/x-font-ttf "access plus 1 month"
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType application/font-woff2 "access plus 1 month"
ExpiresByType application/x-font-woff "access plus 1 month"
ExpiresByType font/woff "access plus 1 month"
</IfModule>
## EXPIRES CACHING ##
#Alternative caching using Apache's "mod_headers", if it's installed.
#Caching of common files - ENABLED
<IfModule mod_headers.c>
# 1 Month
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(js|css|xml|gz|html|ttf)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>
# Set Keep Alive Header
# This *just* sets the header - maybe your hoster is not allowing this feature
# Please check if it is working with tools like http://www.webpagetest.org
<IfModule mod_headers.c>
Header set Connection keep-alive
</IfModule>
# If your server don't support ETags deactivate with "None" (and remove header)
<IfModule mod_expires.c>
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
FileETag None
</IfModule>