2016-06-17 30 views

回答

0

這不會進入的.htaccess,它會進入你的httpd.conf文件。看看這個問題:VirtualHost with wildcard VirtualDocumentRoot

您還需要爲* .example.com設置通配符dns記錄以指向您的服務器。在PHP中,你會有這樣的通配符的index.php文件。

<?php 
    $domain = "test.example.com"; 
    $domain_parts = explode(".", $domain); 
    $username = $domain_parts[0]; 
    header("location: http://example.com/".$username); 
?>