質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

Q&A

0回答

880閲覧

wordpress のマルチサイトで404エラー

scrollman

総合スコア83

WordPress

WordPressは、PHPで開発されているオープンソースのブログソフトウェアです。データベース管理システムにはMySQLを用いています。フリーのブログソフトウェアの中では最も人気が高く、PHPとHTMLを使って簡単にテンプレートをカスタマイズすることができます。

0グッド

0クリップ

投稿2018/01/29 12:03

編集2018/01/29 12:05

ロカール環境にwordpressを入れて運用しております。

サブディレクトリ型のマルチサイト設定を施し、実際にサブサイトを作ってみたのですがサブサイトにアクセスしようとすると404エラーが発生します。

どうすれば正常にサブサイトが表示されますでしょうか

こちらapache2の内容です。
環境:raspberry pi2にraspbian

apache2.confの内容

1**文字数制限により#文省略** 2Mutex file:${APACHE_LOCK_DIR} default 3 4**文字数制限により#文省略** 5PidFile ${APACHE_PID_FILE} 6 7**文字数制限により#文省略** 8Timeout 300 9**文字数制限により#文省略** 10KeepAlive On 11 12**文字数制限により#文省略** 13MaxKeepAliveRequests 100 14 15# 16# KeepAliveTimeout: Number of seconds to wait for the next request from the 17# same client on the same connection. 18# 19KeepAliveTimeout 5 20 21 22# These need to be set in /etc/apache2/envvars 23User ${APACHE_RUN_USER} 24Group ${APACHE_RUN_GROUP} 25 26# 27# HostnameLookups: Log the names of clients or just their IP addresses 28# e.g., www.apache.org (on) or 204.62.129.132 (off). 29# The default is off because it'd be overall better for the net if people 30# had to knowingly turn this feature on, since enabling it means that 31# each client request will result in AT LEAST one lookup request to the 32# nameserver. 33# 34HostnameLookups Off 35 36# ErrorLog: The location of the error log file. 37# If you do not specify an ErrorLog directive within a <VirtualHost> 38# container, error messages relating to that virtual host will be 39# logged here. If you *do* define an error logfile for a <VirtualHost> 40# container, that host's errors will be logged there and not here. 41# 42ErrorLog ${APACHE_LOG_DIR}/error.log 43 44# 45# LogLevel: Control the severity of messages logged to the error_log. 46# Available values: trace8, ..., trace1, debug, info, notice, warn, 47# error, crit, alert, emerg. 48# It is also possible to configure the log level for particular modules, e.g. 49# "LogLevel info ssl:warn" 50# 51LogLevel warn 52 53# Include module configuration: 54IncludeOptional mods-enabled/*.load 55IncludeOptional mods-enabled/*.conf 56 57**文字数制限により#文省略** 58<Directory /> 59 Options FollowSymLinks 60 AllowOverride All 61 Require all denied 62</Directory> 63 64<Directory /usr/share> 65 AllowOverride None 66 Require all granted 67</Directory> 68 69<Directory /var/www/> 70 Options Indexes FollowSymLinks 71 AllowOverride None 72 Require all granted 73</Directory> 74 75#<Directory /srv/> 76# Options Indexes FollowSymLinks 77# AllowOverride None 78# Require all granted 79#</Directory> 80 81 82 83 84# AccessFileName: The name of the file to look for in each directory 85# for additional configuration directives. See also the AllowOverride 86# directive. 87# 88AccessFileName .htaccess 89 90# 91# The following lines prevent .htaccess and .htpasswd files from being 92# viewed by Web clients. 93# 94<FilesMatch "^.ht"> 95 Require all denied 96</FilesMatch> 97 98 99# 100# The following directives define some format nicknames for use with 101# a CustomLog directive. 102# 103# These deviate from the Common Log Format definitions in that they use %O 104# (the actual bytes sent including headers) instead of %b (the size of the 105# requested file), because the latter makes it impossible to detect partial 106# requests. 107# 108# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended. 109# Use mod_remoteip instead. 110# 111LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined 112LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined 113LogFormat "%h %l %u %t \"%r\" %>s %O" common 114LogFormat "%{Referer}i -> %U" referer 115LogFormat "%{User-agent}i" agent 116 117# Include of directories ignores editors' and dpkg's backup files, 118# see README.Debian for details. 119 120# Include generic snippets of statements 121IncludeOptional conf-enabled/*.conf 122 123# Include the virtual host configurations: 124IncludeOptional sites-enabled/*.conf 125 126# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. #ServerName www.example.com ServerAdmin *********** DocumentRoot /var/www/ # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined # For most configuration files from conf-available/, which are # enabled or disabled at a global level, it is possible to # include a line for only one particular virtual host. For example the # following line enables the CGI configuration for this host only # after it has been globally disabled with "a2disconf". #Include conf-available/serve-cgi-bin.conf </VirtualHost> <VirtualHost *:80> ServerAdmin **************** DocumentRoot /var/www/test ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

wordpressの設定

#SITEGUARD_PLUGIN_SETTINGS_START #SITEGUARD_PLUGIN_SETTINGS_END # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] # add a trailing slash to /wp-admin RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L] RewriteRule . index.php [L] # END WordPress

wp

1<?php 2/** 3 * WordPress の基本設定 4 * 5 * このファイルは、インストール時に wp-config.php 作成ウィザードが利用します。 6 * ウィザードを介さずにこのファイルを "wp-config.php" という名前でコピーして 7 * 直接編集して値を入力してもかまいません。 8 * 9 * このファイルは、以下の設定を含みます。 10 * 11 * * MySQL 設定 12 * * 秘密鍵 13 * * データベーステーブル接頭辞 14 * * ABSPATH 15 * 16 * @link http://wpdocs.osdn.jp/wp-config.php_%E3%81%AE%E7%B7%A8%E9%9B%86 17 * 18 * @package WordPress 19 */ 20 21// 注意: 22// Windows の "メモ帳" でこのファイルを編集しないでください ! 23// 問題なく使えるテキストエディタ 24// (http://wpdocs.osdn.jp/%E7%94%A8%E8%AA%9E%E9%9B%86#.E3.83.86.E3.82.AD.E3.82.B9.E3.83.88.E3.82.A8.E3.83.87.E3.82.A3.E3.82.BF 参照) 25// を使用し、必ず UTF-8 の BOM なし (UTF-8N) で保存してください。 26 27// ** MySQL 設定 - この情報はホスティング先から入手してください。 ** // 28/** WordPress のためのデータベース名 */ 29define('DB_NAME', 'wordpress'); 30 31/** MySQL データベースのユーザー名 */ 32define('DB_USER', '**********'); 33 34/** MySQL データベースのパスワード */ 35define('DB_PASSWORD', '*********'); 36 37/** MySQL のホスト名 */ 38define('DB_HOST', '***********'); 39 40/** データベースのテーブルを作成する際のデータベースの文字セット */ 41define('DB_CHARSET', 'utf8mb4'); 42 43/** データベースの照合順序 (ほとんどの場合変更する必要はありません) */ 44define('DB_COLLATE', ''); 45 46/**#@+ 47 * 認証用ユニークキー 48 * 49 * それぞれを異なるユニーク (一意) な文字列に変更してください。 50 * {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org の秘密鍵サービス} で自動生成することもできます。 51 * 後でいつでも変更して、既存のすべての cookie を無効にできます。これにより、すべてのユーザーを強制的に再ログインさせることになります。 52 * 53 * @since 2.6.0 54 */ 55define('AUTH_KEY', '*****************************************************************'); 56define('SECURE_AUTH_KEY', '*****************************************************************'); 57define('LOGGED_IN_KEY', '*****************************************************************'); 58define('NONCE_KEY', '*****************************************************************'); 59define('AUTH_SALT', '*****************************************************************'); 60define('SECURE_AUTH_SALT', '*****************************************************************'); 61define('LOGGED_IN_SALT', '*****************************************************************'); 62define('NONCE_SALT', '*****************************************************************'); 63 64/**#@-*/ 65 66/** 67 * WordPress データベーステーブルの接頭辞 68 * 69 * それぞれにユニーク (一意) な接頭辞を与えることで一つのデータベースに複数の WordPress を 70 * インストールすることができます。半角英数字と下線のみを使用してください。 71 */ 72$table_prefix = '*******_'; 73 74/** 75 * 開発者へ: WordPress デバッグモード 76 * 77 * この値を true にすると、開発中に注意 (notice) を表示します。 78 * テーマおよびプラグインの開発者には、その開発環境においてこの WP_DEBUG を使用することを強く推奨します。 79 * 80 * その他のデバッグに利用できる定数については Codex をご覧ください。 81 * 82 * @link http://wpdocs.osdn.jp/WordPress%E3%81%A7%E3%81%AE%E3%83%87%E3%83%90%E3%83%83%E3%82%B0 83 */ 84define('WP_DEBUG', false); 85define('WP_ALLOW_MULTISITE', true); 86define('MULTISITE', true); 87define('SUBDOMAIN_INSTALL', false); 88define('DOMAIN_CURRENT_SITE', '**********'); 89define('PATH_CURRENT_SITE', '/'); 90define('SITE_ID_CURRENT_SITE', 1); 91define('BLOG_ID_CURRENT_SITE', 1); 92/* 編集が必要なのはここまでです ! WordPress でブログをお楽しみください。 */ 93 94/** Absolute path to the WordPress directory. */ 95if ( !defined('ABSPATH') ) 96 define('ABSPATH', dirname(__FILE__) . '/'); 97 98/** Sets up WordPress vars and included files. */ 99require_once(ABSPATH . 'wp-settings.php');

試み1
試しに作ったサブサイト「/test」を「ルーティングするやつ?.conf」の下のほうに追加してapache2をリロードしましたが、特に変化はありませんでした。

試み2
http://wp-e.org/2015/12/11/6389/
を参考に、 AllowOverride None を AllowOverride Fileinfo に変えてみると、

Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator at ************* to inform them of the time this error occurred, and the actions you performed just before this error. More information about this error may be available in the server error log. Apache/2.4.10 (Raspbian) Server at ************* Port 80

と、サブサイトだけでなくメインサイトまでこう表示されるようになりました。
※上の方では元の状態に戻しました。

という訳です。何卒お願い致します。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問