Luis22 Posted January 16, 2023 Share Posted January 16, 2023 Hi, I migrated a Prestashop 1.7 installation from a cPanel to a Plesk. The website has two languages, but the redirection fails when I write the domain without the primary language in the URL. If I type domain.com in the address bar, Prestashop does not redirect to https://dominio.com/es/. Consequently, the web shows a message that the store is under maintenance. However, the web works fine, although I have yet to make any purchases to check this. But if I type domain.com/en/ directly, it works fine. Among the things I have done to try to fix the problem: I have regenerated the htaccess, I have checked the parameters Shop and Shop_URL in the ps_configuration table in the database. I have cleared the browser and Prestashop caches, Of course, the people on my server have checked everything and found nothing strange. I have disabled Firewalls and any protection on the server in the Plesk installation. Also, Mod_rewrite has been deactivated, and I don't know what else to do anymore. Any idea about why this may be happening and how to fix it? Thanks in advance! Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted January 17, 2023 Share Posted January 17, 2023 does it work fine when you type another language in url? Link to comment Share on other sites More sharing options...
Knowband Plugins Posted January 17, 2023 Share Posted January 17, 2023 You can try the below solution, =>Create an override for Tools.php, switchLanguage() Replace below code if ( ($iso = Tools::getValue('isolang')) && Validate::isLanguageIsoCode($iso) && ($id_lang = (int) Language::getIdByIso($iso)) ) { $_GET['id_lang'] = $id_lang; } With if ( ($iso = Tools::getValue('isolang')) && Validate::isLanguageIsoCode($iso) && ($id_lang = (int) Language::getIdByIso($iso)) ) { $_GET['id_lang'] = $id_lang; } else { $_GET['id_lang'] = (int) Configuration::get('PS_LANG_DEFAULT'); } 1 Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 Unfortunately, overriding the Tools.php, switchLanguage() does not fix the issue. The only thing that works partially, is this redirection I created in the htaccess: RedirectMatch ^/$ /es/ But obviously, when you are in other language, and you click i.e in the logo to go to the homepage, you will be redirected to the default language again. I don't know either, if that redirection can harm the purchase process in some way. But at this moment, it's the only solution it solves the problem. Any other idea, especially how and where to see what could be the error. I'm looking into the logs and I can't see anything. Thanks ahead! Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 Unfortunately, overriding the Tools.php, switchLanguage() does not fix the issue. The only thing that works partially, is this redirection I created in the htaccess: RedirectMatch ^/$ /es/ But obviously, when you are in other language, and you click i.e in the logo to go to the homepage, you will be redirected to the default language again. I don't know either, if that redirection can harm the purchase process in some way. But at this moment, it's the only solution it solves the problem. Any other idea, especially how and where to see what could be the error. I'm looking into the logs and I can't see anything. Thanks ahead! Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 Unfortunately, overriding the Tools.php, switchLanguage() function does not fix the issue. The only thing that works partially, is this redirection I created in the htaccess: RedirectMatch ^/$ /es/ But obviously, when you are in other language, and you click i.e in the logo to go to the homepage, you are redirected to the default language again. I don't know either, if that redirection can harm the purchase process in some way. But at this moment, it's the only solution it solves the problem. Any other idea, especially how and where to see what could be the error? I'm looking into the logs and I can't see any error related to this issue. Thanks ahead! Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted January 17, 2023 Share Posted January 17, 2023 make sure the other language is enabled too Link to comment Share on other sites More sharing options...
El Patron Posted January 17, 2023 Share Posted January 17, 2023 you said mod rewrite was deactivated, that should be activated, we run plesk and put clients on plesk but have never experienced the issue you describe....in domain Hosting Settings, what do you have selected for Preferred domain? You may want to fiddle with that...though I doubt that has anything to do with it... Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 Yeah, of course, it's enabled. Actually, the website works well in both languages. Because as I told you, the only possible problem that can arise from the redirection I've created in the htaccess, is that when someone tries to get the homepage, he will be redirected to the default language, independently he was navigating in another one. I remember this same issue with another Prestashop I was developing in another domain, while the old Joomla store was in production. When I finally moved the Prestshop to the production domain, I had to install it completely from scratch, and then manually copy all its tables and images, because it was not redirecting properly like now. That's what I'd like to avoid this time and, why I'm asking you if there is something that you know can be generating this issue. Other ideas? Link to comment Share on other sites More sharing options...
El Patron Posted January 17, 2023 Share Posted January 17, 2023 2 minutes ago, Luis22 said: Yeah, of course, it's enabled. Actually, the website works well in both languages. Because as I told you, the only possible problem that can arise from the redirection I've created in the htaccess, is that when someone tries to get the homepage, he will be redirected to the default language, independently he was navigating in another one. I remember this same issue with another Prestashop I was developing in another domain, while the old Joomla store was in production. When I finally moved the Prestshop to the production domain, I had to install it completely from scratch, and then manually copy all its tables and images, because it was not redirecting properly like now. That's what I'd like to avoid this time and, why I'm asking you if there is something that you know can be generating this issue. Other ideas? at the top of this you stated it was deactivated....that is only reason I mentioned it....without access it's much more difficult of course to pin point exactly what could be the issue, even a front office link would be very helpful so we can recreate and use chrome inspect to see what's happening possibly. Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 2 minutes ago, PrestaHeroes.com said: you said mod rewrite was deactivated, that should be activated, we run plesk and put clients on plesk but have never experienced the issue you describe....in domain Hosting Settings, what do you have selected for Preferred domain? You may want to fiddle with that...though I doubt that has anything to do with it... I said that I deactivated just looking for the reason of the malfunction, but Mod_rewrite is activated right know, of course! In Plesk in the Preferred Domain setting I have "none", but I tried using both options, with www and without, and it still does not work. In any case, It's the first time I use Plesk for a client, I'm pretty new with it. All my other websites are in hostings using cPanel, and I have been working with it for more than 15 years. I wonder.. Is there any data in the database that can have something to do wit it? I check shop_ulr and shop parameters, and both are fine! Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 9 minutes ago, PrestaHeroes.com said: at the top of this you stated it was deactivated....that is only reason I mentioned it....without access it's much more difficult of course to pin point exactly what could be the issue, even a front office link would be very helpful so we can recreate and use chrome inspect to see what's happening possibly. Is it possible to send you the link in private? It's a company's website, and I would need to don't make it public for privacy reasons. But I would be happy if you could take a look. I can deactivate the redirection I'm using so you can take a look at the problem. Is it possible? Thanks! Link to comment Share on other sites More sharing options...
Luis22 Posted January 17, 2023 Author Share Posted January 17, 2023 (edited) PrestaHeroes.com, I sent you a private message! Hopefully you can see something that helps me to solve it! Thanks ahead! Edited January 17, 2023 by Luis22 (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted January 17, 2023 Share Posted January 17, 2023 (edited) 35 minutes ago, Luis22 said: PrestaHeroes.com, I sent you a private message! Hopefully you can see something that helps me to solve it! Thanks ahead! wrote back, but as mentioned, the front office does not have /es/ in all the links, though when I click the link the /es/ does appear....except as you mentioned for the logo...that makes me feel there is a core change, maybe a 'friendly url' module.... menu has /es/ in link and couple other parts...but not all...products that I checked do not have /es/..the /es/ is being added after click....so that's weird... Edited January 17, 2023 by PrestaHeroes.com (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now