Quantcast
Channel: Learn iPhone, iOS, Objective-c, Swift, cocos2dx, Unity and ....? » WordPress
Viewing all articles
Browse latest Browse all 9

xserver上に入れたwordpressをルートディレクトリからアクセスできるようにする方法

$
0
0

xserverはwordpressの導入が簡単

xserverではGUIでの説明に従ってボタンを押していけば簡単にwordpress環境が構築できます。

wordpressの置き場はpublic_html直下でも問題はないのですが、サブディレクトリに入れておいた方が環境コピーしたりできるの柔軟な対応が可能になります。

今回はpublic_html/wp/に入れたのですがそのままだとアクセスするURLにも/wpを加える必要があります。

ルートディレクトリからアクセスできるようにするには以下のような作業が必要です。

  1. WordPressの管理画面の「設定」->「一般設定」->サイトアドレス(URL)を編集
  2. “http://example.com/wp”

    “http://example.com/”

  3. public_html/index.htmlの削除
  4. public_html/index.htmlを削除しましょう。

  5. public_html/index.phpを作成
  6. 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' );

Viewing all articles
Browse latest Browse all 9

Trending Articles