Skip to content

Instantly share code, notes, and snippets.

View Horttcore's full-sized avatar
💭
Available

Ralf Hortt Horttcore

💭
Available
View GitHub Profile
@Horttcore
Horttcore / .htaccess
Last active June 26, 2020 09:52 — forked from stevegrunwell/.htaccess
Load production WordPress uploads in a local version of the site by putting this in a new Htaccess file in /wp-content/uploads/
# Attempt to load files from production if they're not in our local version (replace {SITE URL} with your production server)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteRule ^(.*)$ https://{SITE URL}/$1 [QSA,L]
</IfModule>
@Horttcore
Horttcore / LocalValetDriver.php
Last active April 14, 2020 15:03
Valet Driver with Remote Fallback
<?php
/**
* Class LocalValetDriver
*
* This class demonstrates how we might go about proxying any missing local images to a remote host. i.e; the production
* site. This has been created with WordPress in mind but could be adjusted to work with any other system.
*/
class LocalValetDriver extends WordPressValetDriver {
@Horttcore
Horttcore / .htaccess
Created February 15, 2020 19:39
Protect WordPress folders and contents
# PROTECT WORDPRESS FOLDERS AND CONTENTS.
RewriteCond %{REQUEST_URI} /wp-admin/
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} \.php$ [NC]
RewriteCond %{REQUEST_URI} !/wp-admin/(load-styles|admin-ajax)\.php$
RewriteCond %{HTTP:Cookie} !wordpress_logged_in_.+
RewriteRule .* - [G,L]
RewriteCond %{REQUEST_URI} /wp-includes/
RewriteCond %{REQUEST_FILENAME} -f