【发布时间】:2012-03-04 20:06:32
【问题描述】:
在我们学院,我们已经实施了我们的网站并将其托管在我们自己的服务器上。服务器是 Apache,操作系统是 Ubuntu。我的同事向我提出了这个问题。他说必须编辑 httpd.conf 文件以重写域名。 我们的网站是这个-> http://cityengineeringcollege.ac.in 该文件中应该有什么以显示正确的域名。在 joomla 全局配置中,即使我们选择在 SEO 设置中使用 URL 重写,URL 也不会被重写。我们将网页请求从 202.62.95.50 定向到 202.62.95.51。 附言 .htaccess 文件有以下重写部分
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/city 和文件 /etc/hosts 有(作为它的第一行)
127.0.0.1 localhost
我认为应该将服务器名称作为别名
127.0.0.1 localhost cityengineeringcollege.ac.in
cityengineeringcollege.ac.in localhost
这是正确的吗?问题是我渴望把事情做好,我们只能在办公时间(9-5)处理这个问题。我们尝试了各种方法,例如使用 grep 在 /etc/apache2 文件夹中搜索 ServerName 并插入该行
ServerName www.cityengineeringcollege.ac.in
无处不在。那里需要www吗?我们在 sites_available 中有一个名为 city 的文件,它是文件 000-default 的克隆,该文件使用
与 sites_enabled 链接sudo a2ensite city
【问题讨论】: