Presta 1.6.1.11
Nginx 1.6.2
Php 5.6
Mam problem z regułkami przyjaznych adresów URL dotyczących integracji fotolia (kategorie i produkty wgrane standardowo do sklepu działają).
Mój aktualny nginx_rewrite.conf:
#location / {
# index /index.php;
#
# rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last;
# rewrite ^/([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2.jpg last;
# rewrite ^/([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3.jpg last;
# rewrite ^/([0-9])([0-9])([0-9])(-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.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-]*)?(-[0-9]+)?/.+\.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-]*)?(-[0-9]+)?/.+\.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-]*)?(-[0-9]+)?/.+\.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-]*)?(-[0-9]+)?/.+\.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-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9.jpg last;
# rewrite ^/c/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
# rewrite ^/c/([a-zA-Z-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1.jpg last;
# rewrite ^/([0-9]+)(-[_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg last;
# try_files $uri $uri/ /index.php?$args;
#}
# Pass API requests to the webservice dispatcher
location ^~ /api/ {
rewrite ^/api/(.*) /webservice/dispatcher.php?url=$1 last;
}
# 1 month expiry on other static stuff
# Also do the friendly URL rewrites
location ~* \.(eot|gif|ico|jpg|jpeg|otf|pdf|png|svg|swf|ttf|woff)$ {
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg break;
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg break;
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg break;
rewrite ^/([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg break;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg break;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg break;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg break;
rewrite ^/([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg break;
rewrite ^/c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg break;
rewrite ^/c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg break;
rewrite ^/images_ie/?([^/]+)\.(jpe?g|png|gif)$ /js/jquery/plugins/fancybox/images/$1.$2 break;
# next line is PSCSX-2790 bug workaround, fixed in 1.6.0.10
rewrite ^/[a-zA-Z]+/img/cms/(.*)$ /img/cms/$1 break;
expires 6M;
add_header Cache-Control public;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
allow all;
}
# 1 week expiry on CSS and JavaScript
location ~ \.(css|js)$ {
expires 1M;
add_header Cache-Control public;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
allow all;
}
# The rest is either served directly or passed on to the dispatcher
location / {
try_files $uri $uri/ /index.php?$args;
}
.htaccess:
RewriteRule ^aktualnosci$ index.php?fc=module&module=advancednews&controller=news
RewriteRule ^aktualnosci/([0-9]+)-([A-Za-z0-9_\-]+)$ index.php?fc=module&module=advancednews&controller=news&cid=$1
RewriteRule ^aktualnosci/([0-9]+)-([A-Za-z0-9_\-]+)/([0-9]+)-([A-Za-z0-9_\-]+).htm$ index.php?fc=module&module=advancednews&controller=news&id=$3 [QSA]
RewriteRule ^aktualnosci/([0-9]+)-([A-Za-z0-9_\-]+).htm$ index.php?fc=module&module=advancednews&controller=news&id=$1 [QSA]
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine on
#Domain: digitaldruk.pl
RewriteBase /
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ /webservice/dispatcher.php?url=$1 [QSA,L]
# resfotoliaapi
RewriteRule ^fsl([a-zA-Z0-9]{10})$ /index.php?fc=module&module=resfotoliaapi&controller=main&shortlink=fsl$1 [QSA,L]
RewriteRule ^([a-z]{2})/([a-zA-Z_-]+).html$ /index.php?fc=module&module=resfotoliaapi&controller=main&furl=$2&isolang=$1 [QSA,L]
RewriteRule ^([a-z]{2})/([a-zA-Z_-]+)-([0-9]{0,4})-([a-zA-Z_-]+).html$ /index.php?fc=module&module=resfotoliaapi&controller=main&furl=$2&id_kat=$3&isolang=$1 [QSA,L]
RewriteRule ^([a-z]{2})/([a-zA-Z_-]+)-([0-9]{0,4})-([a-zA-Z_-]+)-([0-9wf]+)-([a-zA-Z_-]*).html$ /index.php?fc=module&module=resfotoliaapi&controller=main&furl=$2&id_kat=$3&id_prod=$5&cat_name=$4&isolang=$1 [QSA,L]
RewriteRule ^([a-zA-Z_-]+).html$ /index.php?fc=module&module=resfotoliaapi&controller=main&furl=$1 [QSA,L]
RewriteRule ^([a-zA-Z_-]+)-([0-9]{0,4})-([a-zA-Z_-]+).html$ /index.php?fc=module&module=resfotoliaapi&controller=main&furl=$1&id_kat=$2 [QSA,L]
RewriteRule ^([a-zA-Z_-]+)-([0-9]{0,4})-([a-zA-Z_-]+)-([0-9wf]+)-([a-zA-Z_-]*).html$ /index.php?fc=module&module=resfotoliaapi&controller=main&furl=$1&id_kat=$2&id_prod=$4&cat_name=$3 [QSA,L]
RewriteRule ^img-preview/([^/]*)$ /reset/modules/fotolia/effects.php?src=$1 [QSA,L]
RewriteRule ^crop-preview/([^/]*)$ /reset/modules/fotolia/crop_preview.php?src=$1 [QSA,L]
# resphotoupload
RewriteRule ^([a-z]{2})/wydruk-z-twojego-zdjecia$ /index.php?fc=module&module=resphotoupload&controller=creator&isolang=$1 [QSA,L]
RewriteRule ^([a-z]{2})/wydruk-z-twojego-zdjecia-([a-zA-Z_-]+)$ /index.php?fc=module&module=resphotoupload&controller=creator&furl=$2&isolang=$1 [QSA,L]
RewriteRule ^([a-z]{2})/wydruk-z-twojego-zdjecia-([0-9]+)$ /index.php?fc=module&module=resphotoupload&controller=creator&w=$2&isolang=$1 [QSA,L]
RewriteRule ^wydruk-z-twojego-zdjecia$ /index.php?fc=module&module=resphotoupload&controller=creator [QSA,L]
RewriteRule ^wydruk-z-twojego-zdjecia-([a-zA-Z_-]+)$ /index.php?fc=module&module=resphotoupload&controller=creator&furl=$1 [QSA,L]
RewriteRule ^wydruk-z-twojego-zdjecia-([0-9]+)$ /index.php?fc=module&module=resphotoupload&controller=creator&w=$1 [QSA,L]
# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ /img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ /img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
</IfModule>
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404
# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
Po konwersji na tej stronie -
https://winginx.com/en/htaccess - gdy przykładowo wkleję taką część kodu do nginx_rewrite:
location / {
rewrite "^/([a-z]{2})/wydruk-z-twojego-zdjecia$" /index.php?fc=module&module=resphotoupload&controller=creator&isolang=$1 break;
rewrite "^/([a-z]{2})/wydruk-z-twojego-zdjecia-([a-zA-Z_-]+)$" /index.php?fc=module&module=resphotoupload&controller=creator&furl=$2&isolang=$1 break;
rewrite "^/([a-z]{2})/wydruk-z-twojego-zdjecia-([0-9]+)$" /index.php?fc=module&module=resphotoupload&controller=creator&w=$2&isolang=$1 break;
}
Po wejściu na stronę i kliknięciu w link, na dysk pobiera się plik, zamiast uruchomić daną podstronę, czy nawet wypluć 404