Skip to content

Instantly share code, notes, and snippets.

Antoine Guilbert antoineguilbert

View GitHub Profile
View redirect-subfolder-to-a-new-domain
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^folder1(.*)$ http://www.newdomain.com/$1 [L,R=301]
</IfModule>
View redirect-non-www-to-www-prestastop-backoffice
RewriteEngine on
RewriteCond %{SERVER_NAME} =yoursite.com
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
View get-visitors-per-day-with-apache-logs
cat /var/log/apache2/access.log | grep "\[05/Sep/2010" |awk '{print $1}' | sort | uniq | wc -l
@antoineguilbert
antoineguilbert / get-referring-url-apache-logs
Last active Jan 16, 2017
Get top referring URL via Apache logs
View get-referring-url-apache-logs
cut -d'"' -f4 /var/log/apache/access.log | grep -v '^-$' | grep -v '^http://www.yoursite.com' | sort | uniq -c | sort -rg
View sql-prestashop-update-available-order
UPDATE ps_product_shop SET available_for_order =0 WHERE id_product IN (
SELECT id_product
FROM `ps_product`
);
@antoineguilbert
antoineguilbert / sql-prestashop-products-with-categories
Created Dec 9, 2016
Get easily with a SQL command products with categories on Prestashop
View sql-prestashop-products-with-categories
SELECT p.id_product, pl.name, GROUP_CONCAT(DISTINCT(cl.name) SEPARATOR ",") as categories, p.price, p.reference, pm.name, pl.description_short, pl.description, p.date_add
FROM ps_product p
LEFT JOIN ps_product_lang pl ON (p.id_product = pl.id_product)
LEFT JOIN ps_category_product cp ON (p.id_product = cp.id_product)
LEFT JOIN ps_category_lang cl ON (cp.id_category = cl.id_category)
LEFT JOIN ps_category c ON (cp.id_category = c.id_category)
LEFT JOIN ps_manufacturer pm ON (p.id_manufacturer = pm.id_manufacturer)
WHERE pl.id_lang = 1
AND cl.id_lang = 1
AND p.id_shop_default = 1
You can’t perform that action at this time.