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

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

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

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

FuelPHP

FuelPHPは、軽量高速で開発が可能なPHPのWebアプリケーションフレームワークです。

Q&A

解決済

1回答

4218閲覧

FuelPHPで、index.phpの省略が出来ない

退会済みユーザー

退会済みユーザー

総合スコア0

Apache

Apacheは、Apache HTTP Serverの略で、最も人気の高いWebサーバソフトウェアの一つです。安定性が高いオープンソースソフトウェアとして商用サイトから自宅サーバまで、多くのプラットフォーム向けに開発・配布されています。サーバーソフトウェアの不具合(NCSA httpd)を修正するパッチ(a patch)を集積、一つ独立したソフトウェアとして開発されました。

FuelPHP

FuelPHPは、軽量高速で開発が可能なPHPのWebアプリケーションフレームワークです。

0グッド

1クリップ

投稿2017/11/28 10:36

編集2017/11/28 10:56

###前提・実現したいこと
FuelPHPをインストールして、welcomeページが表示できる所まで来ました。
既存アプリを加えてアクセスしようとしたところ、
http://192.168.0.142/fuel/index.php/login」では表示されますが、
http://192.168.0.142/fuel/login」では表示されません。

なお、非FuelPHPコンテンツとの同居のために、
「/var/www/html/fuel」がFuelPHPのトップになります。
FuelPHP本体は、「/var/www/fuel」にあります。

###発生している問題・エラーメッセージ

404 Not Found The requested URL /fuel/login was not found on this server.

となり、.htaccessによる書き換えが失敗しているように見えます。

###該当のソースコード
.htaccessのコメント行を省いたものを掲載します。

SetEnv FUEL_ENV development <IfModule mod_rewrite.c> RewriteEngine on AllowOverride All RewriteBase /fuel RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$ RewriteCond %{THE_REQUEST} ^[^/]*/index.php [NC] RewriteRule ^index.php(.*)$ $1 [R=301,NS,L] <IfModule mod_fcgid.c> RewriteCond %{HTTP:Authorization} . RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] </IfModule> # Send request via index.php if not a real file or directory RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # deal with php-fcgi first <IfModule mod_fcgid.c> RewriteRule ^(.*)$ index.php?/$1 [QSA,L] </IfModule> # no php-fcgi, check for sapi and fpm <IfModule !mod_fcgid.c> # for PHP5 sapi installations <IfModule mod_php5.c> RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_php5.c> # for PHP7 sapi installations <IfModule mod_php7.c> RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> # for fpm installations <IfModule !mod_php7.c> RewriteRule ^(.*)$ index.php?/$1 [QSA,L] </IfModule> </IfModule> </IfModule> </IfModule>

###試したこと
httpdに読み込まれているモジュールはこうなっています。

# httpd -t -D DUMP_MODULES Loaded Modules: core_module (static) so_module (static) http_module (static) access_compat_module (shared) actions_module (shared) alias_module (shared) allowmethods_module (shared) auth_basic_module (shared) auth_digest_module (shared) authn_anon_module (shared) authn_core_module (shared) authn_dbd_module (shared) authn_dbm_module (shared) authn_file_module (shared) authn_socache_module (shared) authz_core_module (shared) authz_dbd_module (shared) authz_dbm_module (shared) authz_groupfile_module (shared) authz_host_module (shared) authz_owner_module (shared) authz_user_module (shared) autoindex_module (shared) cache_module (shared) cache_disk_module (shared) data_module (shared) dbd_module (shared) deflate_module (shared) dir_module (shared) dumpio_module (shared) echo_module (shared) env_module (shared) expires_module (shared) ext_filter_module (shared) filter_module (shared) headers_module (shared) include_module (shared) info_module (shared) log_config_module (shared) logio_module (shared) mime_magic_module (shared) mime_module (shared) negotiation_module (shared) remoteip_module (shared) reqtimeout_module (shared) rewrite_module (shared) setenvif_module (shared) slotmem_plain_module (shared) slotmem_shm_module (shared) socache_dbm_module (shared) socache_memcache_module (shared) socache_shmcb_module (shared) status_module (shared) substitute_module (shared) suexec_module (shared) unique_id_module (shared) unixd_module (shared) userdir_module (shared) version_module (shared) vhost_alias_module (shared) dav_module (shared) dav_fs_module (shared) dav_lock_module (shared) lua_module (shared) mpm_prefork_module (shared) proxy_module (shared) lbmethod_bybusyness_module (shared) lbmethod_byrequests_module (shared) lbmethod_bytraffic_module (shared) lbmethod_heartbeat_module (shared) proxy_ajp_module (shared) proxy_balancer_module (shared) proxy_connect_module (shared) proxy_express_module (shared) proxy_fcgi_module (shared) proxy_fdpass_module (shared) proxy_ftp_module (shared) proxy_http_module (shared) proxy_scgi_module (shared) proxy_wstunnel_module (shared) ssl_module (shared) systemd_module (shared) cgi_module (shared) fcgid_module (shared) wsgi_module (shared) php7_module (shared)

###補足情報(言語/FW/ツール等のバージョンなど)
CentOS Linux release 7.3.1611 (Core)
PHP 7.1.4 (cli) (built: Apr 11 2017 18:26:18) ( NTS )
Server version: Apache/2.4.6 (CentOS)
Server built: Apr 12 2017 21:03:28

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

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

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

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

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

guest

回答1

0

ベストアンサー

自己解決しました。

「<Directory "/var/www/html">」の中で、
「AllowOverride None」となっていたせいで、
.htaccessファイルを読み込まないようになっていたようで、
「AllowOverride All」にしたところ、
/var/www/fuel/public/.htaccessが効き始めたものの500 Internal Server Errorに変わり、
/var/www/fuel/public/.htaccess内で「AllowOverride All」行をコメントアウトしたら、
無事にURLの書き換えが機能するようになりました。

たいへんお騒がせしました。
これからも設定のまずさを晒すかもしれませんが、よろしくお願いします。

参考:Apache チュートリアル: .htaccess ファイル

一般に、.htaccess ファイルの構文は 主設定ファイル と同じです。これらのファイルに書くことのできるディレクティブは AllowOverride ディレクティブにより決まります。 このディレクティブは、.htaccess ファイルに 書かれたディレクティブの中で、、 どのディレクティブが適用されるかをカテゴリー単位で指定します。 .htaccess に書くことのできるディレクティブであれば、 説明文書には「上書き」という項目があり、.htaccess に書くことができるように なるための AllowOverride の値が指定されています。

投稿2017/11/29 01:45

退会済みユーザー

退会済みユーザー

総合スコア0

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問