Skip to content

Instantly share code, notes, and snippets.

@tatuas
Created January 4, 2014 15:13
Show Gist options
  • Save tatuas/8256281 to your computer and use it in GitHub Desktop.
Save tatuas/8256281 to your computer and use it in GitHub Desktop.
CoreServerでCakePHPを運用
public_html内にはwebroot意外を設置しない方法。
デフォルトの構成を大幅に崩すので注意。
~/cake_app
-domain1
--app
-domain2
--app
~/lib
-cake_core
--cake
--plugins
--vendors
--.git
--.gitignore
--.htaccess
--.travis.html
--README
~/public_html
.htaccess(webrootにリクエストを振るため。きちんとドメイン設定すれば必要ない。というか、domainname/domain1ならここに置く必要さえない。)
-domain1
--webroot(cake_appからのシンボリックリンクでも可能)
webroot/index.php
if (!defined('ROOT')) {
define('ROOT', DS.'virtual'.DS.'nc31sf'.DS.'cake_app'.DS."domain1");
}
if (!defined('APP_DIR')) {
define ('APP_DIR', 'app');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS.'virtual'.DS.'nc31sf'.DS.'lib'.DS.'cake_core');
}
app/webroot/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /domain1/webroot/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
~/public_html/domain1/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /domain1/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment