Skip to content

Instantly share code, notes, and snippets.

@nickdaugherty
nickdaugherty / vip-reverse-proxy-with-subdirectory.php
Last active March 30, 2018 22:53
Example code for running a VIP site behind a reverse proxy with a subdirectory. This assumes the proxy server can't rewrite the html, such as on CloudFront. Props to 10up / Dropbox for much of the code.
<?php
define( 'PROXY_URL', 'https://mysite.com/subdirectory' );
/**
* Map the mysite home page to the proxy subdirectory
*/
function mysite_map_home_page(){
add_rewrite_rule( '^'. get_mysite_proxy_subdirectory() .'/?$', 'index.php', 'top' );
add_rewrite_rule( '^'. get_mysite_proxy_subdirectory() .'/page/?([0-9]{1,})/?$', 'index.php?paged=$matches[1]', 'top' );
@rayrutjes
rayrutjes / ais-wp.css
Created July 7, 2016 12:48
Some boilerplate to create an instantsearch.js search experience in your WordPress theme. This works in combination with the Algolia Search plugin for WordPress.
#ais-wrapper {
display: flex;
}
#ais-main {
padding: 1rem;
width: 100%;
}