xserverはwordpressの導入が簡単
xserverではGUIでの説明に従ってボタンを押していけば簡単にwordpress環境が構築できます。
wordpressの置き場はpublic_html直下でも問題はないのですが、サブディレクトリに入れておいた方が環境コピーしたりできるの柔軟な対応が可能になります。
今回はpublic_html/wp/に入れたのですがそのままだとアクセスするURLにも/wpを加える必要があります。
ルートディレクトリからアクセスできるようにするには以下のような作業が必要です。
- WordPressの管理画面の「設定」->「一般設定」->サイトアドレス(URL)を編集
- public_html/index.htmlの削除
- public_html/index.phpを作成
“http://example.com/wp”
↓
“http://example.com/”
public_html/index.htmlを削除しましょう。
wp/以下にある同名ファイルをコピーして最後の行を以下のように変更します。
“require( dirname( __FILE__ ) . ‘./wp-blog-header.php’ );”
↓
“require( dirname( __FILE__ ) . ‘/wp/wp-blog-header.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( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );