LoginSignup
2
3

More than 5 years have passed since last update.

WordPressのサイトURLをドメイン直下に変更したい

Posted at

パーマリンク設定

  1. WordPress管理画面から、設定 > 一般 を開く
  2. サイトアドレス (URL) のサブディレクトリ部分を削除

変更前
wp_siteaddress_before.png

変更後
wp_siteaddress_after.png

index.php と .htaccess

  1. FTPクライアントなどでWordPressをインストールしているサーバにアクセス
  2. インストールしたディレクトリにあるindex.phpを、ルートディレクトリにコピー
  3. ルートディレクトリへコピーしたindex.phpを編集

変更前

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

変更後

/** Loads the WordPress Environment and Template */  
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );
  1. ルートディレクトリに.htaccessを作成
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

以上

2
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3