Skip to content

Instantly share code, notes, and snippets.

@Debadge
Debadge / .htaccess
Created May 10, 2016 10:08
301 Redirect HTTPS back to HTTP
# HTTPS back to HTTP Redirect
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on [OR]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
@Debadge
Debadge / fix_multisite_srcset.php
Created February 17, 2016 14:07
Fixes srcset URLs on WordPress Multisite installations when using Domain Mapping
// Fix the URLS generated by media srcset from WP 4.4+
//
// When viewing the srcset URLs for images on a 4.4+ WordPress installation,
// it was showing my multisite subdomain URL rather than the domain chosen during Domain Mapping
//
// Add to your functions.php and modify the URL fields
//
// See: https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/
function fix_multisite_srcset( $sources ){
foreach ( $sources as &$source ) {