ubuntu - 在joomla而不是域名中,IP地址显示在地址栏中(URL重写规则)!

标签 ubuntu joomla web

在我们学院,我们已经实现了我们的网站并将其托管在我们自己的服务器上。服务器是 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

最佳答案

这不是 Joomla 的问题。 Joomla 对所有内容都使用相对 URL,因此域名由 htaccess 文件中的重定向、未正确编码的扩展名或服务器本身控制。如果它在 Drupal 中也这样做,那么我会说这是一个服务器配置问题。

轻松测试 - 将 index.html 上传到您安装了 Joomla 的根目录,然后访问该文件。如果域重定向到 IP 地址,则很可能是服务器配置问题。

关于ubuntu - 在joomla而不是域名中,IP地址显示在地址栏中(URL重写规则)!,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9494084/

相关文章:

linux - Hugo 错误 - 当前主题不支持当前版本

php - 使用 Joomla 展示产品

python - 需要从带有 "show more"按钮的网页中抓取信息,有什么建议吗?

matlab - 编译 Matlab MEX 文件时出错(Piotr 的 Matlab 工具箱)

node.js - 413 请求实体太大 nginx/1.14.0

java - Ubuntu 上的 JDK 问题

php - 无法在本地主机上安装 joomla

php - 使用外部表单登录 Joomla 1.5(不在 joomla 文件夹中,但在同一台服务器上)

javascript - 引用错误 : process is not defined Module. ../../../node_modules/graphql/jsutils/instanceOf.mjs

java - 网页响应时间较长,第二次尝试后恢复正常