Monday, November 15, 2004

ユーザごとにdocumentrootを変更する

RewriteEngine  on
RewriteCond  %{HTTP_HOST}  ^www\.hogehoge\.jp$
RewriteRule  (.*)           /usr/local/apache/htdocs$1  [L]

RewriteCond  %{HTTP_HOST}   ^www\.[^.]+\.hogehoge\.jp$
RewriteRule  (.*)     %{HTTP_HOST}$1 [C]
RewriteRule  ^www\.([^.]+)\.hogehoge\.jp(.*)  /home/$1/public_html$2  [L]

RewriteCond  %{HTTP_HOST}   ^[^.]+\.hogehoge\.jp$
RewriteRule   (.*)    %{HTTP_HOST}$1 [C]
RewriteRule   ^([^.]+)\.hogehoge\.jp(.*)   /home/$1/public_html$2  [L]
-------------------------------------------------------------
サブドメインアクセスを適切なURLに書き直す。
例: http://aaa.hoge.comのアクセスを http://www.hoge.com/aaa/ にする。
   ( httpd.conf or .htaccess ) 
バーチャルホストで定義する

   ServerName hoge.com
   ServerAlias *.hoge.com
   ServerAdmin info@hoge.com
   RewriteEngine On
   RewriteCond %{HTTP_HOST} ([^\.]+).*
   RewriteRule ^/$ /%1/ [R]

1 comment:

Basiballi said...

Hi hi, I read your post which I find interesting and very informative! I was also looking for related info which I found
Some at internet
It's not exactly what I was looking for but it was nonetheless interesting to read.