WordPress 101

Course Day 3

Editing Database And Files

MyWEB SQL, Adminer, Search and Replace, Search Regex, SQL Executioner, Edit Any Table, WP Clean Up, Find Replace, Safe Search and Replace

Editing WP-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );

/** MySQL database username */
define( 'DB_USER', 'username_here' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

Editing WP-config.php

define( 'WP_POST_REVISIONS', false );
define( 'WP_POST_REVISIONS', 3 );

define( 'WP_DEBUG', true );
define( 'WP_DEBUG', false );

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

define( 'WP_CACHE', true );

define( 'FS_CHMOD_DIR', ( 0755 & ~ umask() ) );
define( 'FS_CHMOD_FILE', ( 0644 & ~ umask() ) );

 

 

Editing WP-config.php

define( 'FS_METHOD', 'ftpext' );
define( 'FTP_BASE', '/path/to/wordpress/' );
define( 'FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/' );
define( 'FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/' );
define( 'FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub' );
define( 'FTP_PRIKEY', '/home/username/.ssh/id_rsa' );
define( 'FTP_USER', 'username' );
define( 'FTP_PASS', 'password' );
define( 'FTP_HOST', 'ftp.example.org' );
define( 'FTP_SSL', false );

 

 

Editing .htaccess

## Apache 2.2
Order deny,allow
Deny from all
Allow from xxx.xxx.xxx.xxx

 

## Apache 2.2
Order deny,allow
Deny from xxx.xxx.xxx.xxx
Deny from xxx.xxx.xxx.xxy

 

 

 

Editing .htaccess

RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]

 

 

 

Deny Access To Hidden Files

Editing .htaccess

<FilesMatch "(\.(bak|config|dist|fla|inc|ini|log|psd|sh|sql|swp)|~)$">
    ## Apache 2.2
    Order allow,deny
    Deny from all
    Satisfy All

    ## Apache 2.4
    # Require all denied
</FilesMatch>

 

 

 

Deny Access To Backup and Source Files

Editing .htaccess

ErrorDocument 500 "Houston, we have a problem."
ErrorDocument 401 http://error.example.com/mordor.html
ErrorDocument 404 /errors/halflife3.html

Custom Error Pages

Editing .htaccess

<FilesMatch "\.(tex|log|aux)$">
    Header set Content-Type text/plain
</FilesMatch>

Prevent Downloading

Made with Slides.com