LoginSignup
2
3

More than 5 years have passed since last update.

FuelPHPでindex.phpを省略する

Posted at

誰もが調べるであろう「index.phpの省略」・・・
(例えば http://localhost/blog/public/index.php/posthttp://localhost/blog/public/post でアクセスしたい)
ここでえらくハマっていたので覚え書き。

調べたら出てくる変更

調べたらすぐに出てくる3つの変更。

fuel/app/config/config.php
/**
 * index_file - The name of the main bootstrap file.
 *
 * Set this to 'index.php if you don't use URL rewriting
 */
- //'index_file' => false,
+ 'index_file' => false,
PROJECT_NAME/public/.htaccess
#Remove index.php from URL
- #RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
- #RewriteCond %{THE_REQUEST}               ^[^/]*/index\.php [NC]
- #RewriteRule ^index\.php(.*)$         $1 [R=301,NS,L]

+ RewriteCond %{HTTP:X-Requested-With}  !^XMLHttpRequest$
+ RewriteCond %{THE_REQUEST}                ^[^/]*/index\.php [NC]
+ RewriteRule ^index\.php(.*)$          $1 [R=301,NS,L]
httpd.conf
- AllowOverride None
+ AllowOverride All

これをやってなかった

apacheの設定。mod_rewrite読み込み有効にしてなかった…!

httpd.conf
- #LoadModule rewrite_module libexec/apache2/mod_rewrite.so
+ #LoadModule rewrite_module libexec/apache2/mod_rewrite.so

参考サイト

おかげさまで解決いたしました。ありがとうございました。
http://pilomen164.hatenablog.com/entry/2013/09/23/191957

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