WordPress

wp-config.phpでURLやwp-configの場所を定義する

More than 1 year has passed since last update.

ディレクトリ構成

index.php
wp (gitのsubmoduleとしてWordPressをインストールする)
wp-content (wp/wp-contentの内容を複製して外に置く)
wp-config.php

wp-config.php, index.php

wp-config.php
$URL = 'http://YOUR_DOMAIN';

# WordPress Address
define('WP_SITEURL', $URL.'/wp/');

# Site Address
define('WP_HOME', $URL.'/');

# wp-content Directory
define('WP_CONTENT_DIR', dirname(__FILE__).'/wp-content');

# wp-content Address
define('WP_CONTENT_URL', $URL.'/wp-content');

index.php
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require('./wp/wp-blog-header.php');