仕事

さくらサーバー初期ドメイン直下にワードプレスを設置する方法

以下ブログがとてもわかりやすかった。

https://www.nishi2002.com/34630.html

https://www.nishi2002.com/4718.html

まとめると、

  1. いったんディレクトリ(wpなど)にインストール
  2. ワードプレス管理画面「サイトアドレス」のみ直下URLへ
  3. index.phpと.htaccessをドメイン直下に
  4. index.phpと.htaccessの中身を修正

index.phpの変更

現在
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

変更後
require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );

.htaccessの変更

修正前の.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp/ → この行を変更
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp/index.php [L] → この行を変更
</IfModule>

修正後の.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase / → このように変更
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] → このように変更
</IfModule>

エックスサーバーみたいに、ドメイン直下だとしてもサクッといってくれよ。さくらさん。

 

※さくらサーバーについては以下ブログも詳しいです。
https://wiz-t.jp/blog/

-仕事