2012-02-15 4 views
0

を.PHPするサブドメインを再マッピング:CodeIgniterの複数のワイルドカードのサブドメインを持つアプリケーションでは、mod_rewriteの私はそうのように構成さCodeIgniterのプロジェクトを持っている

httpdocs/ 
    /application/ 
    /ggg/ 
     config/ 
     controllers/ 
     models/ 
     libraries/ 
     views/ 
     ... 
    /sgaz/ 
     config/ 
     controllers/ 
     models/ 
     libraries/ 
     views/ 
     ... 
    /index/ 
     config/ 
     controllers/ 
     models/ 
     libraries/ 
     views/ 
     ... 
    /system/ 
    index.php 

私は再びそのにマップするワイルドカードのサブドメインを記述しようとしていますそれぞれのアプリケーション..これについてどうやって行くのか分かりません。

複数のアプリケーションを作成し、各アプリケーション(IE:ggg.php、sgaz.php、index.php)に複数の(。*).phpファイルを使用することができます。しかし、単一のindex.phpファイルを持ち、mod_rewriteを使用して、サブドメインからの呼び出しをそれぞれのアプリケーションenvにリダイレクトすることは可能ですか? IE:http://ggg.mapitusa.com/user/loginhttp://mapitusa.com/index.php/ggg/user/loginに(htaccessなし)リダイレクトしますか?

ありがとうございます!

答えて

0

サイトのルートディレクトリにある.htaccessファイルに次を追加してみてください。

RewriteEngine on 
RewriteBase/

RewriteCond %{HTTP_HOST} ^([^\.]+)\.mapitusa\.com$ [NC] 
#if not existing file or directory 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
#rewrite to index.php 
RewriteRule^index.php/%1%REQUEST_URI] [L] 

あなたはアドレスバーのURLがhttp://mapitusa.com/index.php/ggg/user/login?に変更したい場合は、

RewriteRule^http://mapitusa.com/index.php/%1%REQUEST_URI] [L,R=301] 
して上記のRewriteRuleを置き換えます
関連する問題