Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Мультимова та Nginx+php-fpm


markimax
 Share

Запитання:
Чому при використанні мультимовності з префіксами (/ua/, /en/ та т.п.) /ua/index.php?route= ... сайт на OpenCart падає з 404 у VestaCP/Hestia (Nginx+php-fpm без Apache)?

 

Відповідь:
Це типова помилка у хостерів, які ставлять панелі VestaCP/Hestia з дефолтним конфігом Nginx. Вони ставлять помилковий конфіг. Він не враховує архітектуру OpenCart і неправильно обробляє мовні URL. У результаті запити вигляду /ua/index.php?route= ... сервер не пропускає і повертає 404.

 

Рішення:
У блоці

location ~ [^/]\.php(/|$)

перед

if (!-f $document_root$fastcgi_script_name) { return 404; }

додайте:

if (!-e $request_filename) {
    rewrite ^/(.+)$ /index.php?_route_=$1 last;
}

 

 

Як це є по аналогії в дефолтном OpenCart .htacceess

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

 


Comments

Guest
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.