2012-02-29 128 views
0

在我們學院,我們實施了我們的網站並將其託管在我們自己的服務器上。服務器是Apache,操作系統是Ubuntu。我的同事給我提出了這個問題。他說,必須編輯httpd.conf文件以重寫域名。 我們的網站是This->http://cityengineeringcollege.ac.in 該文件中應該有什麼來顯示正確的域名。在joomla全局配置中,即使我們選擇在SEO設置中使用URL重寫,URL也不會被重寫。我們正在將網頁請求從202.62.95.50導向202.62.95.51。 PS .htaccess文件有以下重寫部分在joomla而不是域名,IP地址顯示在地址欄(URL重寫規則)!

RewriteBase /city 

## Begin - Joomla! core SEF Section. 
# 
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 
# 
# If the requested path and file is not /index.php and the request 
# has not already been internally rewritten to the index.php script 
RewriteCond %{REQUEST_URI} !^/index\.php 
# and the request is for something within the component folder, 
# or for the site root, or for an extensionless URL, or the 
# requested URL ends with one of the listed extensions 
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC] 
# and the requested path and file doesn't directly match a physical file 
RewriteCond %{REQUEST_FILENAME} !-f 
# and the requested path and file doesn't directly match a physical folder 
RewriteCond %{REQUEST_FILENAME} !-d 
# internally rewrite the request to the index.php script 
RewriteRule .* index.php [L] 
# 

配置文件/etc/apache2/httpd.conf具有下面的代碼

<VirtualHost *> 
ServerName www.cityengineeringcollege.ac.in 
DocumentRoot /var/www 
.... 
</VirtualHost> 

我的問題是是文檔根目錄正確像我認爲應該是在/ var/WWW /城市和文件/ etc/hosts中有(作爲第一行)

127.0.0.1 localhost 

,我認爲應該有服務器名稱爲n別名如

127.0.0.1 localhost cityengineeringcollege.ac.in 
cityengineeringcollege.ac.in localhost 

這是正確的嗎?事情是我渴望把事情做好,我們只能在辦公時間(9-5)工作。我們已經嘗試了各種各樣的事情就像用grep在/ etc搜索服務器名/ apache2目錄和插入線

ServerName www.cityengineeringcollege.ac.in 

到處發現。 www需要那裏嗎?我們有一個叫做城市裏面sites_available文件,該文件是文件000默認的克隆和文件與使用

sudo a2ensite city 

回答

0

sites_enabled我不知道其中的原因聯繫起來,這是最有可能的一部分你索引頁面。但是當我訪問它時,我的瀏覽器正在被重定向。這意味着你的joomla代碼中的某處發出以下內容:

header("Location: http://202.62.95.51/city//"); 

這導致網站被轉發到IP地址。如果你沒有修改任何代碼,只使用Joomla,那麼它很可能是joomla中的一個函數,因爲它肯定來自PHP。

Browser network trace

+0

他告訴我他使用drupal並開發了另一個地址爲http://202.62.95.51/dcity//的網站,問題依然存在。 – 2012-02-29 17:57:24

1

這不是一個Joomla問題。 Joomla使用相對URL來處理所有事情,以便域名由您的htaccess文件中的重定向,未正確編碼的擴展或服務器本身控制。如果它在Drupal中也是這樣,那麼我會說這是一個服務器配置問題。

簡單測試 - 將index.html上傳到您安裝了Joomla的根目錄,然後訪問該文件。如果域重定向到IP地址,那麼它很可能是服務器配置問題。

+0

我瀏覽了httpd.conf,發現VirtualHost標籤內的ServerName在 ... 之後。 ServerName命令然後是ServerAlias然後ServerAdmin然後DocumentRoot然後必須被跟隨?我的朋友忘了重啓服務器,所以我不能說它是否重要。 – 2012-03-01 14:50:32

0

我的系統管理員說問題已經解決。他沒有詳細說明究竟所有步驟,但表示,在.htaccess中的RewriteBase已經變回了

RewriteBase/

而且的DocumentRoot改爲/ WWW /城市,它的工作之後。現在他正在忙於使用drupal開發的一個評論中提到的直覺性。我忘了提及我們的服務器使用基於名稱的虛擬主機。還有另一個網站(域名),我們將與我們自己一起託管。我想感謝所有以這種或那種方式提供幫助的回答者。