【Apache】mod_rewriteについて語るスレat PHP
【Apache】mod_rewriteについて語るスレ - 暇つぶし2ch494:nobodyさん
10/03/25 10:21:37 Vmjt6F6A
mod_rewriteの設定について

mod_rewriteの設定について

現在 *.test.example.comへのアクセスはドキュメントルートが/home/homepage/public_html/ になっています。

サブドメイン名でアクセスするディレクトリを変更したいです。
例)
xxx.test.example.com → /home/homepage/public_html/xxx/
yyy.text.example.com → /home/homepage/public_html/yyy/

以下のように設定してみたのですが、思い通りにいかない事がいくつかあります。

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{HTTP_HOST} ^[a-z]+\.test\.example\.com$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([a-z]+)\.test\.example\.com(.*)$ /$1/$2
</IfModule>


URLリンク(xxx.test.example.com) → ○
URLリンク(xxx.test.example.com) → ×(index.htmlが表示されて欲しい)
URLリンク(xxx.test.example.com) → ×(/xxx/img/img.jpg は存在します)

分かる方よろしくお願いします。




次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch