Skip to content

Instantly share code, notes, and snippets.

@ttoz
Created March 14, 2012 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ttoz/2034885 to your computer and use it in GitHub Desktop.
Save ttoz/2034885 to your computer and use it in GitHub Desktop.
MVCフレームワーク用の一般的な.htaccess
DirectoryIndex index.php index.html
RewriteEngine on
# 該当ファイルが存在せず、かつindex.htmlが存在しない場合にのみ
# index.phpにリクエストクエリを渡して実行する。
# これにより、http://domain/static_html/にアクセスがあった場合に
# index.phpにリライトされることなく、index.htmlを表示できる。
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond $1 !^(index\.php|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L] [L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment