Skip to content

Instantly share code, notes, and snippets.

@jennimckinnon
jennimckinnon / .htaccess
Created August 4, 2016 17:17
Rename WordPress login page. Replace "key=123". Based on the code from the WCEU 2016 talk by Maurizio Pelizzone.
# BEGIN Hide login page
RewriteRule ^mylogin$ https://%{SERVER_NAME}/wp-login.php?key=123&redirect_to=https://%{SERVER_NAME}/wp-admin/index.php [L]
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/wp-admin
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/wp-login.php
RewriteCond %{HTTP_REFERER} !^https://%{SERVER_NAME}/login
RewriteCond %{QUERY_STRING} !^key=123
RewriteCond %{QUERY_STRING} !^action=logout
RewriteCond %{QUERY_STRING} !^action=lostpassword
RewriteCond %{REQUEST_METHOD} !POST
/** Sets up WordPress vars and included files. */
define( 'UPLOADS', 'wp-content/media' );
require_once(ABSPATH . 'wp-settings.php');
define( 'UPLOADS', 'wp-content/media' );
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/new-folder/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'https://your-site.com/new-folder/wp-content/plugins' );
define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/directory/wp-content' );
define( 'WP_CONTENT_URL', 'https://your-site.com/directory/wp-content' );
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
@jennimckinnon
jennimckinnon / wp-config.php
Created August 2, 2016 03:58
Updating the WordPress address to include a directory.
define('WP_SITEURL', 'https://' . $_SERVER['SERVER_NAME'] . '/application');
define('WP_HOME', 'https://' . $_SERVER['SERVER_NAME']);
@jennimckinnon
jennimckinnon / wp-config.php
Last active July 29, 2016 22:08
Creating custom WordPress file structure, via Maurizio Pelizzone at WCEU 2016 http://wordpress.tv/2016/07/01/maurizio-pelizzone-wordpress-hardening-ten-tips-in-ten-minutes/
define('WP_CONTENT_DIR', dirname(__FILE__) . '/public');
define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/public');
define( 'WP_UPLOADS_DIR', dirname(__FILE__) . '/uploads' );
define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/application');
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME']);
@jennimckinnon
jennimckinnon / .htaccess
Last active July 21, 2016 01:29
hide your login page with code in WordPress. Replace "key=123". From WCEU 2016 talk by Maurizio Pelizzone: http://wordpress.tv/2016/07/01/maurizio-pelizzone-wordpress-hardening-ten-tips-in-ten-minutes/
# BEGIN Hide login page
RewriteRule ^mylogin$ wp-login.php?key=123&redirect_to=http://%{SERVER_NAME}/wp- admin/index.php [L]
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/wp-admin
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/wp-login.php
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/login
RewriteCond %{QUERY_STRING} !^key=123
RewriteCond %{QUERY_STRING} !^action=logout
RewriteCond %{QUERY_STRING} !^action=lostpassword
RewriteCond %{REQUEST_METHOD} !POST