Configuración de Nginx vhost para hacer funcionar prestashop 1.7.x en Nginx

Adjuntamos la configuración testeada de las rewrites de nginx para hacer funcionar Prestashop 1.7.x. Después de testear diferentes configuraciones que no funcionaban completamente, adjuntamos ésta configuración testeada y verificada:

#Solucionado: Configuración vhost para nginx de Prestashop v1.7.x funcionando www.servidoresadmin.com
#Prestashop v1.7.x nginx vhost
#Configuración para nginx vhost prestashop 1.7.x www.servidoresadmin.com
#Reemplazar adminxxxxxxxxx por la url de la administración de la tienda

location ~* \.(png|jpg|jpeg|gif|ico|js|css|svg)$ {
expires 1y;
}

# Rewrites globales
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
rewrite “^/c/([0-9]+)(\-[_a-zA-Z0-9-]*)/(.*)\.jpg$” /img/c/$1$2.jpg last;
rewrite “^/c/([_a-zA-Z-]+)/(.*)\.jpg$” /img/c/$1.jpg last;
rewrite “^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/(\P{M}\p{M}*)*\.jpg$” /img/p/$1-$2$3.jpg last;
rewrite “^/([0-9]+)\-([0-9]+)/(\P{M}\p{M}*)*\.jpg$” /img/p/$1-$2.jpg last;
rewrite “^/([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$1$2.jpg last;
rewrite “^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$1$2$3.jpg last;
rewrite “^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$3/$1$2$3$4.jpg last;
rewrite “^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$3/$4/$1$2$3$4$5.jpg last;
rewrite “^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6.jpg last;
rewrite “^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7.jpg last;
rewrite “^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8.jpg last;
rewrite “^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/(\P{M}\p{M}*)*\.jpg$” /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
rewrite “^/([0-9]+)\-(\P{M}\p{M}*)+\.html(.*)$” /index.php?controller=product&id_product=$1$3 last;
rewrite “^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$” /index.php?controller=category&id_category=$1$3 last;
rewrite “^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$” /index.php?controller=product&id_product=$2$4 last;
rewrite “^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$” /index.php?controller=supplier&id_supplier=$1$3 last;
rewrite “^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$” /index.php?controller=manufacturer&id_manufacturer=$1$3 last;
rewrite “^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$” /index.php?controller=cms&id_cms=$1$3 last;
rewrite “^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$” /index.php?controller=cms&id_cms_category=$1$3 last;
rewrite “^/module/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$” /index.php?fc=module&module=$1&controller=$2 last;
rewrite “^/stock/([_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)$” /index.php?controller=$1$2 last;
rewrite ^/[a-zA-Z][a-zA-Z]/index.php(.*)$ /index.php$1;
try_files $uri $uri/ /index.php?$args;

# Rewrites para controladores Symfony para prestashop 1.7

##Reemplazar adminxxxxxxxxx por la url de la administración de la tienda
location ~ /(international|_profiler|product|combination|specific-price)/(.*)$ {
try_files $uri $uri/ /index.php?q=$uri&$args /adminxxxxxxxxx/index.php$is_args$args;
}

##Reemplazar adminxxxxxxxxx por la url de la administración de la tienda

location /adminxxxxxxxxx/ {
if (!-e $request_filename) {
rewrite ^/.*$ /adminxxxxxxxxx/index.php last;
}
}

location / {
if (!-e $request_filename) {
rewrite ^/.*$ /index.php last;
}
}

 

Vigilar de reemplazar los 3 /adminxxxxxxxxx/ por el de la tienda concreta.

Luego iremos a Configurar parámetros de la tienda y pondremos en SI :La reescritura URL (mod_rewrite) no está activa en tu servidor o no es posible comprobar la configuración del servidor. Si deseas usar URLs amigables debes activar este módulo.

También dejaremos en 301 el Redirigir a la URL canónica:

 

configurar seo prestashop 1.7

configurar seo prestashop 1.7