Ms7 Search
Google 搜尋 翻譯
calendar
« 四月 2026 »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      
近期文章
文章分類
網站連結
Syndicate

二級域名設置說明

2007-04-24 @ 19:49 in Linux

就是在申請的域名前以 * 通用字元來表示,即不管你輸入 test.mydomain.com 或 test1.mydomain.com 都可以指到 mydomain.com 的 ip ,
再利用 apache 的 mod_rewrite 做轉址,至於如何轉址,還在研究

2007/04/09補充
編修 /etc/httpd/conf/httpd.conf 增加下面
目的將網址開頭不是 www 或 ftp 開頭一律轉址為 ~user
例:user.shyong.com.tw => shyong.com.tw/~user
<VirtualHost *:80>
ServerAdmin root@shyong.com.tw
DocumentRoot /var/www/html
ServerName shyong.com.tw
ServerAlias linux.shyong.com.tw *.shyong.com.tw
<Directory /var/www/html>
AllowOverride None
Order deny,allow
#AddDefaultCharset UTF8
</Directory>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} !^w{1,3}.shyong.com.tw$ [NC]
RewriteCond %{HTTP_HOST} !^ftp.shyong.com.tw$ [NC]
RewriteCond %{HTTP_HOST} ^[^.]+.shyong.com.tw$ [NC]
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+).shyong.com.tw(.*)$ http://shyong.com.tw/~$1$2%{QUERY_STRING} [L]
</IfModule>
</VirtualHost>
 

引用

引用本文的文章標題:二級域名設置說明