0

CodeIgniter インストールの次の構造を整理できるかどうかを知りたいです。

- Main folder
-- codeigniter
-- images
-- site1-application
-- site2-application
-- site1-index.php
-- site2-index.php

主なアイデアは、メンテナンスを容易にするために、複数の Web サイトで同じ画像codeigniterフォルダーを使用することです。

今のところ、2 つの標準インストールに存在する 2 つの Web サイトがあり、画像フォルダーを共有したり、複数の Web サイトでシステム ライブラリを同時に更新したりすることができません。

私は.htaccessファイルで少し遊んだことがありますが、うまくいきません:(

前もって感謝します!

4

2 に答える 2

2

デフォルトの推奨CodeIgniter.htaccessファイル:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  #CodeIgniter
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]
  RewriteRule ^$ /index.php [L]
</IfModule>

目的に合わせてCI.htaccessファイルを微調整しました(1年遅すぎます)。

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  #CodeIgniter
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d

  # Check for Domain 1 with a path
  RewriteCond %{HTTP_HOST} domain-1.com
  RewriteRule ^(.*)$ /site1-index.php/$1 [L]
  # Check for Domain 1 without a path
  RewriteCond %{HTTP_HOST} domain-1.com
  RewriteRule ^$ /site1-index.php [L]

  # Check for Domain 2 with a path
  RewriteCond %{HTTP_HOST} domain-2.com
  RewriteRule ^(.*)$ /site2-index.php/$1 [L]
  # Check for Domain 2 without a path
  RewriteCond %{HTTP_HOST} domain-2.com
  RewriteRule ^$ /site2-index.php [L]
</IfModule>
于 2011-10-06T20:29:32.847 に答える
0

はい、可能です。

.htaccess を使用して、あるドメインからのすべてのトラフィックを site1-index.php に向け、別のドメインからのすべてのトラフィックを site2-index.php に向けます。

CI アプリケーションおよびシステム フォルダーの場所は、*-index.php ファイルで設定されます。

于 2010-09-21T22:36:34.557 に答える