2011-08-16 66 views
0

我剛剛推出了一個新的網站,我有基本的URL爲:笨基地網址無法正常工作

$配置[ 'BASE_URL'] = 'http://x.com/';

哪些工作,但是當我在我的瀏覽器中訪問www.x.com我得到頁面未找到錯誤。 當我設置基地址爲'http://www.x.com/'。現在該網站不再工作了。 有誰知道如何解決這個問題?我迷失在如何實現這一目標。

回答

0

這聽起來像你確實有一個問題,你VirtualHosts。這將解釋你爲什麼得到404的。嘗試添加到您的httpd.conf或等效,然後重新啓動Apache:

# Place this in the virtualhost listening to x.com. 
ServerAlias www.x.com 
+0

做到了,謝謝! –

0

嘗試:

$config['base_url'] = 'http'; 
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"){ 
    $config['base_url'] .= "s"; 
} 
$config['base_url'] .= "://"; 
if ($_SERVER["SERVER_PORT"]!= "80"){ 
    $config['base_url'] .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"]; 
}else{ 
    $config['base_url'] .= $_SERVER["SERVER_NAME"]; 
} 

$config["base_url"]."/";