Skip to content

Instantly share code, notes, and snippets.

View chrisdavidmiles's full-sized avatar
💙

Chris David Miles chrisdavidmiles

💙
View GitHub Profile
@chrisdavidmiles
chrisdavidmiles / .htaccess
Created May 23, 2017 19:25
Secure MIME Types .htaccess
# BEGIN Secure MIME-types
<FilesMatch "\.[Jj][Pp][Ee]?[Gg]$">
ForceType image/jpeg
</FilesMatch>
<FilesMatch "\.[Pp][Nn][Gg]$">
ForceType image/png
</FilesMatch>
<FilesMatch "\.[Gg][Ii][Ff]$">
ForceType image/gif
</FilesMatch>
@chrisdavidmiles
chrisdavidmiles / wp-connection-test.php
Last active May 29, 2016 16:23
This is a database connectivity script for WordPress. It's designed to help troubleshoot the dreaded "Error Establishing Database Connection" error. To use this tool, create a file in the same folder as wp-config.php, place this code in it, and access the file in a browser.
<?php
/**
* This is a database connectivity script for WordPress.
* It's designed to help troubleshot the dreaded "Error Establishing Database Connection" error.
*
* How does it work? It uses regular expressions to match the database settings in the wp-config.php
* and then tests those settings. If there is an error thrown, the script interprets the error and
* prints actionable information that can be used to fix the site, if at all possible. If the database
* connection works, the script will run a REPAIR on all tables in the database, and print the results.
@chrisdavidmiles
chrisdavidmiles / xmlrpc.php
Created March 19, 2016 23:23
Instead of disabling or deleting xmlrpc.php in WordPress, replace it with this file, which would serve one of several sarcastic error messages at random.
<?php $possible_messages = [
'Nope',
'Go away',
'Nice try',
'XML-RPC requests on this server have been disabled cuz of people like you. This is why we can\'t have nice things.',
'We don\'t serve your kind here',
'<img src="//i.imgur.com/oeLBdQJ.png">',
'<img src="//i.imgur.com/ZZW6M6P.gif"><hr>Did you really think an xmlrpc.php attack would work on this site?',
'<img src="//i.imgur.com/OkQFngF.png"><hr>Get off my site! (And stop trying to access people\'s xmlrpc.php files.)',