0

HMVC を使用して codeigniter で Web サイトを開発しています。HMVC モジュールを指す複数のサブドメインがあります。現在の .htacess には含まれています

DirectoryIndex index.php
RewriteEngine On
RewriteCond $1 !^(index\.php|themes|assets|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]

ファイル構造

./application
    /modules
        /news_module
        /mobile_module
        /api_module
./system/

入力時は正常に動作します

http://mysite.com/news_module/controller/method
http://mysite.com/mobile_module/controller/method
http://mysite.com/api_module/controller/method

しかし、私はからリダイレクトしたい

http://mysite.com/mobile_module/controller/method

http://m.mysite.com/mobile_module/controller/method

(mobile_module) を非表示にして、最後に

http://m.mysite.com/controller/method

誰かタイプの場合

http://m.mysite.com/mobile_module/controller/method

私も欲しい

http://m.mysite.com/controller/method

どうすれば.htaccessでこれを行うことができますか?

4

1 に答える 1

0

質問の最初の部分は次のように使用します。

RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^mobile_module/(.*) http://m.example.com/$1 [R=301,L]

誰かがm.mysite.com/mobile_module/_______と入力する方法がわかりませ

于 2011-12-30T17:50:19.773 に答える