Skip to content

Instantly share code, notes, and snippets.

View peacefulseeker's full-sized avatar

Alexey Vorobyov peacefulseeker

  • Riga
View GitHub Profile
@peacefulseeker
peacefulseeker / .htaccess_browser_cache_enable
Created July 12, 2017 15:11
Htaccess Browser Cache Enable
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType image/jpeg "access plus 4 weeks"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/gif "access plus 43829 minutes"
ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
ExpiresByType text/css "access plus 604800 seconds"
ExpiresByType text/javascript "access plus 604800 seconds"
@peacefulseeker
peacefulseeker / .htaccess_deflate_enable
Created July 12, 2017 15:12
Htaccess Deflate Enable
<IfModule deflate_module>
<IfModule filter_module>
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml
AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf
AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf
</IfModule>
</IfModule>
@peacefulseeker
peacefulseeker / .htaccess_restrict_file_access_filtered_by_ip
Last active July 19, 2017 12:00
Htaccess restrict access to files with certain IP accessibility filter
<Files pphinfo.php>
Order deny,allow
Deny from all
Allow from <ip1> <ip2>
</Files>
@peacefulseeker
peacefulseeker / .htaccess_require_ip_for_accessing_the_page
Last active July 19, 2017 12:11
Htaccess require ip for access the pages
<RequireAll>
Require ip <ip1> <ip2>
</RequireAll>
@peacefulseeker
peacefulseeker / .htaccess_deny_from_except_ip
Last active July 19, 2017 12:12
Htaccess Deny from All except IP OLD Version
order deny,allow
deny from all
allow from <ip goes here>
@peacefulseeker
peacefulseeker / wp-disable-emojis.php
Created September 8, 2017 09:21
WordPress - Disable Emojis
/**
* Disable the emoji's
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
@peacefulseeker
peacefulseeker / .htaccess_force_https_only
Created September 19, 2017 10:19
Htaccess force HTTPS only
# Force HTTPS redirection
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
@peacefulseeker
peacefulseeker / .htaccess_redirect_root_to_subfolder
Created November 22, 2017 09:53
Htaccess - Redirect WordPress root to a subfolder
# Redirecting root to subfolder /ccds/
RedirectMatch ^/$ /ccds/
@peacefulseeker
peacefulseeker / detect_ie11.js
Created November 24, 2017 15:24
jQuery - Detect MSIE 11
if ( !(window.ActiveXObject) && "ActiveXObject" in window ) {
/* IE 11*/
$("html").addClass('MSIE MSIE11');
}
@peacefulseeker
peacefulseeker / .htaccess_rewrite_folder_in_url
Last active November 27, 2017 15:47
Htaccess rewrite folder path and redirect
<IfModule mod_rewrite.c>
# IMPORTANT TO PLACE IT BEFORE OTHER REWRITE RULES. REDIRECTS ONE FOLDER PATH TO ANOTHER
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^produkte/(.*)$ /pm_produkte/$1 [L,NC,R=302]
</IfModule>