Last active
October 9, 2018 17:17
-
-
Save prestarocket/5280139 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name MY.WEBSITE.TLD; | |
root /Users/ME/Sites/FOLDER; | |
client_header_buffer_size 16k; | |
large_client_header_buffers 16 16k; | |
# qsa | |
rewrite ^/api/?(.*)$ /webservice/dispatcher.php?url=$1 last; | |
rewrite ^/([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2$3.jpg last; | |
rewrite ^/([0-9]+)\-([0-9]+)/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1-$2.jpg last; | |
rewrite ^/([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$1$2.jpg last; | |
rewrite ^/([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-9-]*\.jpg$ /img/p/$1/$2/$1$2$3.jpg last; | |
rewrite ^/([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)?/[_a-zA-Z0-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-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last; | |
rewrite ^/c/([a-zA-Z-]+)/[a-zA-Z0-9-]+\.jpg$ /img/c/$1.jpg last; | |
### qsa | |
rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 last; | |
rewrite ^/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1$3 last; | |
rewrite ^/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 last; | |
rewrite ^/([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 last; | |
rewrite ^/([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 last; | |
rewrite ^/content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1$3 last; | |
rewrite ^/content/category/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms_category=$1$3 last; | |
### //qsa | |
rewrite ^/([0-9]+)(\-[_a-zA-Z0-9-]*)/[_a-zA-Z0-9-]*\.jpg$ /img/c/$1$2.jpg last; | |
### qsa | |
rewrite ^/page-non-trouvee(.*)$ /404.php$1 last; | |
rewrite ^/adresse(.*)$ /address.php$1 last; | |
rewrite ^/adresses(.*)$ /addresses.php$1 last; | |
rewrite ^/authentification(.*)$ /authentication.php$1 last; | |
rewrite ^/meilleures-ventes(.*)$ /best-sales.php$1 last; | |
rewrite ^/panier(.*)$ /cart.php$1 last; | |
rewrite ^/contactez-nous(.*)$ /contact-form.php$1 last; | |
rewrite ^/bons-de-reduction(.*)$ /discount.php$1 last; | |
rewrite ^/suivi-commande-invite(.*)$ /guest-tracking.php$1 last; | |
rewrite ^/historique-des-commandes(.*)$ /history.php$1 last; | |
rewrite ^/identite(.*)$ /identity.php$1 last; | |
rewrite ^/marques(.*)$ /manufacturer.php$1 last; | |
rewrite ^/mon-compte(.*)$ /my-account.php$1 last; | |
rewrite ^/nouveaux-produits(.*)$ /new-products.php$1 last; | |
rewrite ^/commande(.*)$ /order.php$1 last; | |
rewrite ^/details-de-la-commande(.*)$ /order-follow.php$1 last; | |
rewrite ^/commande-rapide(.*)$ /order-opc.php$1 last; | |
rewrite ^/avoirs(.*)$ /order-slip.php$1 last; | |
rewrite ^/mot-de-passe-oublie(.*)$ /password.php$1 last; | |
rewrite ^/promotions(.*)$ /prices-drop.php$1 last; | |
rewrite ^/recherche(.*)$ /search.php$1 last; | |
rewrite ^/plan-du-site(.*)$ /sitemap.php$1 last; | |
rewrite ^/magasins(.*)$ /stores.php$1 last; | |
rewrite ^/fournisseurs(.*)$ /supplier.php$1 last; | |
### // qsa | |
location ~ \.php$ { | |
include /opt/local/etc/nginx/fastcgi.conf; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /Users/ME/Sites/FOLDER$fastcgi_script_name; | |
} | |
location / { | |
root /Users/ME/Sites/FOLDER; | |
index index.php index.html index.htm; | |
# this serves static files that exist without running other rewrite tests | |
if (-f $request_filename) { | |
expires 30d; | |
break; | |
} | |
# Rewrite rules | |
if (!-e $request_filename) { | |
rewrite ^(.+)$ /index.php?q=$1 last; | |
} | |
} | |
# Admin zone no PATH_INFO // admin loop | |
location ~ /backend/.*\.php$ { | |
include /opt/local/etc/nginx/fastcgi.conf; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
#fastcgi_param PATH_INFO $fastcgi_script_name; | |
fastcgi_buffer_size 32k; | |
fastcgi_buffers 4 32k; | |
} | |
# PHP scripts -> PHP-FPM server listening on 127.0.0.1:9000 | |
location ~ \.php$ { | |
include /opt/local/etc/nginx/fastcgi.conf; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
fastcgi_buffer_size 32k; | |
fastcgi_buffers 4 32k; | |
} | |
# Security | |
location ~ /\.ht { | |
deny all; | |
} | |
# Stuffs | |
location = /robots.txt { access_log off; log_not_found off; } | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location ~* ^.+\.(jpg|jpeg|gif|css|png|js|xml)$ { | |
expires 30d; | |
access_log off; | |
#set $memcached_key $uri; | |
#memcached_pass 127.0.0.1:11211; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do this also work for a multi-language prestashop installation ?
I have some 404 during the order process :(