ethna アプリケーションを
http://www.domain/index.php?action_F=0&p=0123
↓
http://www.domain/exe/F/0123
http://www.domain/index.php?action_A=0&e=456
↓
http://www.domain/exe/A/456
http://www.domain/index.php?action_E=0&e=789
↓
http://www.domain/exe/E/789
で動作させる。
●mod_rewite
●PHP5限定?PEARのNet_URL_Mapper
には依存しない。
●シェルを使えないレンタルサーバーを考慮しシンボリックリンクを張らない。
これを実現する必要最小限の方法は次のとおり。
http://www.domain/index.php?action_F=0&p=0123
↓
http://www.domain/exe/F/0123
http://www.domain/index.php?action_A=0&e=456
↓
http://www.domain/exe/A/456
http://www.domain/index.php?action_E=0&e=789
↓
http://www.domain/exe/E/789
で動作させる。
●mod_rewite
●PHP5限定?PEARのNet_URL_Mapper
には依存しない。
●シェルを使えないレンタルサーバーを考慮しシンボリックリンクを張らない。
これを実現する必要最小限の方法は次のとおり。
各ディレクトリの .htaccess ファイルの設定を有効とする為
apache1.3系なら
/etc/httpd/conf/httpd.conf
apache2系なら
/etc/apache2/conf/httpd.conf
で
AllowOverride All
とする。
エントリーポイントを配置するディレクトリの .htaccess ファイル
DirectoryIndex exe <FilesMatch "^exe$"> ForceType application/x-httpd-php </FilesMatch>ethna のデフォルトのエントリーポイントファイル "index.php" を "exe" にリネームし$_SERVER['URL_HANDLER']を追加
<?php require_once '/XXX/APPID/app/Fm_Controller.php'; $_SERVER['URL_HANDLER'] = 'index'; APPID_Controller::main('APPID_Controller', 'index'); ?>
APPID_UrlHandler.php
class Fm_UrlHandler extends Ethna_UrlHandler{ var $action_map = array( 'index' => array( 'F' => array( 'path' => 'F', 'path_regexp' => '|^F/(.*)$|', 'path_ext' => array( 'p' => array() ), ), 'A' => array( 'path' => 'A', 'path_regexp' => '|^A/(.*)$|', 'path_ext' => array( 'e' => array() ), ), 'E' => array( 'path' => 'E', 'path_regexp' => '|^E/(.*)$|', 'path_ext' => array( 'e' => array() ), ), ), ); ~さらに、同じく APPID_UrlHandler.php で
class Fm_UrlHandler extends Ethna_UrlHandler{ ~ function _getPath_Index(){ return array("/exe/", array()); } ~APPID/etc/APPID-ini.php で
'url' => 'http://www.domain/',としてsmartyテンプレートで
{url action="F" p=$form.p}
{url action="A" e=$form.e}
{url action="E" e=$form.e}
とすれば、それぞれ
http://www.domain/exe/F/0123
http://www.domain/exe/A/456
http://www.domain/exe/E/789
に展開され、テンプレートへEthna_AppObjectをアサインし
{url action="F" p=$appObj->get('p')}
とすることも可能。
-------------------------
レンタルサーバーAbleNet
Vine Linux 4.2 (Lynch Bages)
PHP Version 4.4.8
Apache/1.3.41 (Unix) (Vine/Linux) PHP/4.4.8
Vine Linux 4.2 (Lynch Bages)
PHP Version 5.2.9
Apache/2.2.3 (Unix)