PHPのフレームワークCodeIgniterをインストールしてから行ったこと。
http://localhost/CodeIgniter/ に設置
CodeIgniterへの設置状態
. |-- index.php |-- license.txt `-- system |-- application | |-- config | | |-- autoload.php | | |-- config.php | | |-- constants.php | | |-- database.php | | |-- doctypes.php | | |-- hooks.php | | |-- index.html | | |-- mimes.php | | |-- routes.php | | |-- smileys.php | | `-- user_agents.php | |-- controllers | | |-- index.html | | `-- welcome.php | |-- errors | | |-- error_404.php | | |-- error_db.php | | |-- error_general.php | | |-- error_php.php | | `-- index.html | |-- helpers | | `-- index.html | |-- hooks | | `-- index.html | |-- index.html | |-- language | | `-- english | | `-- index.html | |-- libraries | | `-- index.html | |-- models | | `-- index.html | `-- views | |-- index.html | `-- welcome_message.php |-- cache | `-- index.html |-- codeigniter | |-- Base4.php | |-- Base5.php | |-- CodeIgniter.php | |-- Common.php | |-- Compat.php | `-- index.html |-- database | |-- DB.php | |-- DB_active_rec.php | |-- DB_cache.php | |-- DB_driver.php | |-- DB_forge.php | |-- DB_result.php | |-- DB_utility.php | |-- drivers | | |-- index.html | | |-- mssql | | | |-- index.html | | | |-- mssql_driver.php | | | |-- mssql_forge.php | | | |-- mssql_result.php | | | `-- mssql_utility.php | | |-- mysql | | | |-- index.html | | | |-- mysql_driver.php | | | |-- mysql_forge.php | | | |-- mysql_result.php | | | `-- mysql_utility.php | | |-- mysqli | | | |-- index.html | | | |-- mysqli_driver.php | | | |-- mysqli_forge.php | | | |-- mysqli_result.php | | | `-- mysqli_utility.php | | |-- oci8 | | | |-- index.html | | | |-- oci8_driver.php | | | |-- oci8_forge.php | | | |-- oci8_result.php | | | `-- oci8_utility.php | | |-- odbc | | | |-- index.html | | | |-- odbc_driver.php | | | |-- odbc_forge.php | | | |-- odbc_result.php | | | `-- odbc_utility.php | | |-- postgre | | | |-- index.html | | | |-- postgre_driver.php | | | |-- postgre_forge.php | | | |-- postgre_result.php | | | `-- postgre_utility.php | | `-- sqlite | | |-- index.html | | |-- sqlite_driver.php | | |-- sqlite_forge.php | | |-- sqlite_result.php | | `-- sqlite_utility.php | `-- index.html |-- fonts | |-- index.html | `-- texb.ttf |-- helpers | |-- array_helper.php | |-- compatibility_helper.php | |-- cookie_helper.php | |-- date_helper.php | |-- directory_helper.php | |-- download_helper.php | |-- email_helper.php | |-- file_helper.php | |-- form_helper.php | |-- html_helper.php | |-- index.html | |-- inflector_helper.php | |-- language_helper.php | |-- number_helper.php | |-- path_helper.php | |-- security_helper.php | |-- smiley_helper.php | |-- string_helper.php | |-- text_helper.php | |-- typography_helper.php | |-- url_helper.php | `-- xml_helper.php |-- index.html |-- language | |-- english | | |-- calendar_lang.php | | |-- date_lang.php | | |-- db_lang.php | | |-- email_lang.php | | |-- form_validation_lang.php | | |-- ftp_lang.php | | |-- imglib_lang.php | | |-- index.html | | |-- number_lang.php | | |-- profiler_lang.php | | |-- scaffolding_lang.php | | |-- unit_test_lang.php | | |-- upload_lang.php | | `-- validation_lang.php | `-- index.html |-- libraries | |-- Benchmark.php | |-- Calendar.php | |-- Cart.php | |-- Config.php | |-- Controller.php | |-- Email.php | |-- Encrypt.php | |-- Exceptions.php | |-- Form_validation.php | |-- Ftp.php | |-- Hooks.php | |-- Image_lib.php | |-- Input.php | |-- Language.php | |-- Loader.php | |-- Log.php | |-- Model.php | |-- Output.php | |-- Pagination.php | |-- Parser.php | |-- Profiler.php | |-- Router.php | |-- Session.php | |-- Sha1.php | |-- Table.php | |-- Trackback.php | |-- Typography.php | |-- URI.php | |-- Unit_test.php | |-- Upload.php | |-- User_agent.php | |-- Validation.php | |-- Xmlrpc.php | |-- Xmlrpcs.php | |-- Zip.php | `-- index.html |-- logs | `-- index.html |-- plugins | |-- captcha_pi.php | |-- index.html | `-- js_calendar_pi.php `-- scaffolding |-- Scaffolding.php |-- images | |-- background.jpg | |-- index.html | `-- logo.jpg |-- index.html `-- views |-- add.php |-- delete.php |-- edit.php |-- footer.php |-- header.php |-- index.html |-- no_data.php |-- stylesheet.css `-- view.php
.htaccessを作成
初期状態だと、index.php ファイルがURLの中に含まれるのでhttp://codeigniter.jp/user_guide_ja/general/urls.htmlにあるようにhtaccessを設置。
サブディレクトリにフレームワークを呼ぶ形になるので、http://codeigniter.jp/user_guide_ja/general/urls.htmlのとおりだとうまくいかないのでRewriteRuleを若干修正。
ついでにimgとlib対象からを外しておく。
RewriteEngine on RewriteCond $1 !^(index\.php|img|lib|robots\.txt) RewriteRule ^(.*)$ /CodeIgniter/index.php/$1 [L]
URLに.htmlの拡張子をつけるように修正<ガイドのURLサフィックス(接尾辞)の追加ってやつ。>
system/application/config/config.phpのurl_suffixを修正
<?php $config['url_suffix'] = ".html";