2012-03-09 107 views
-1

我剛剛創建了一個子域info.domain.com,我想要的是將每個登錄我網站的用戶與一個子域關聯起來,例如jose.domain.com,juan.domain.com等。 .. 這將是什麼代碼。 htaccess的?Apache mod_rewrite重定向

回答

0

你想使用通配符子域名。以下應該將GET參數用戶等於用戶名的www之外的所有內容傳遞給index.php文件。

RewriteCond %{HTTP_HOST} !www.example.com [NC] 
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).example.com [NC] 
Rewriterule ^(.*)$ /index.php?user=$1 [NC,L] 
+0

This give me Internal Server Error – wyknzo 2012-03-09 22:05:16