2014-03-27 80 views
0

我已經在我的AWS EC2 apache中設置了以下虛擬主機。apache url重寫不會從url中刪除IP地址

<VirtualHost 99.999.999.999:80> 

    DocumentRoot /var/www/html/mysite 
ServerName site.com 

# Other directives here ... 

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> 
Header set Cache-Control "max-age=290304000, public" 
</FilesMatch> 
</VirtualHost> 

但是它仍然顯示URL作爲99.999.999.999/directory/index.php

我已經按照設置和我想知道如果有件事情我已經在這裏錯過了嗎?

我期待的結果是,當我在我的瀏覽器中鍵入www.site.com時,它會轉到www.site.com/directory/index.php。目前輸入這個將會發送給我99.999.999.999/directory/index.php。

我的印象是,設置在我定義將停止IP地址的方式,虛擬主機被顯示,而是顯示在服務器名稱爲site.com

+0

什麼問題? – arco444

+0

我假設你想要你的網址爲site.com/directory/index.php。 – CrazySabbath

+0

你能多解釋一下嗎? – Rico

回答

0

虛擬主機不會重寫網址當你通過IP地址訪問它時。

例如,你可以用http://www.google.comhttp://74.125.20.105/

訪問谷歌如果你去的IP地址,它會顯示IP,如果你去到指定的域,它會去的名字。嘗試使用名稱。