Skip to content

Instantly share code, notes, and snippets.

@j26design
j26design / .htaccess
Last active January 8, 2016 06:48
Enable compression with deflate in .htaccess
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rdf+xml application/rss+xml application/schema+json application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-javascript application/x-web-app-manifest+json application/xhtml+xml application/xml font/eot font/opentype image/bmp image/svg+xml image/vnd.microsoft.icon image/x-icon text/cache-manifest text/css text/html text/javascript text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy text/xml
</ifmodule>
@j26design
j26design / .htaccess
Last active February 2, 2016 05:20
Remove .html file extension
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
@j26design
j26design / .htaccess
Last active December 20, 2015 21:26
www .htaccess redirects
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to non-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Redirect to www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>
@j26design
j26design / .htaccess
Last active December 20, 2015 21:01
Redirect from old domain to new domain
## Redirect from olddomain to newdomain
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to non-www
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule (.*)$ http://newdomain.com/$1 [R=301,L]
# Redirect to www
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
@j26design
j26design / continueShoppingRedirect.js
Last active December 20, 2015 21:15 — forked from makfruit/ecwid_redirect_continue_shopping.html
An HTML/Javascript code snippet for Ecwid to redirect continue shopping buttons to a custom page
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(function() {
// Redirect address. Change it to the URL of page where you want to redirect your customers.
// You can use absolute or relative addresses, e.g. 'index.html', 'http://google.com'
var continueShoppingRedirect = "#!/~/category/id=0";
// Delay (ms), which is necessary for the empty cart page to appear after onCartChange event firing
var empty_cart_page_delay = 500;
// Continue shopping buttons CSS selectors
@j26design
j26design / activeMenu.js
Last active December 28, 2015 08:38
Add a class to menu items that match the current URL of the page (jQuery)
jQuery(function(){
var page = window.location.pathname,
find = new RegExp(page == '/' ? window.location.origin + '/?jQuery' : page.replace(/\/jQuery/,''));
jQuery('nav a').each(function(){
if(find.test(this.href.replace(/\/jQuery/,''))){
jQuery(this).addClass('active');
}
});
});