【发布时间】:2021-04-29 12:45:12
【问题描述】:
我们有一个包含以下内容的虚拟主机文件,
NameVirtualHost *:8888
<VirtualHost *:8888>
ServerName example.domain.com
ServerAlias example
DocumentRoot /opt/weblogic/product/virtualhosts/example.domain.com/htdocs
ErrorLog /opt/weblogic/product/virtualhosts/example.domain.com/logs/error_log
RewriteEngine On
#RewriteRule ^/?$ %{REQUEST_URI}/StartPage [R,L]
RewriteOptions Inherit
DirectoryIndex index.html startpage.jsp
<Directory />
Require all granted
</Directory>
</VirtualHost>
我们可以使用服务器名和别名访问应用程序。
- http://example.domain.com 扩展为 http://example.domain.com/StartPage/startpage.jsp
- http://example 扩展为 http://example/StartPage/startpage.jsp
现在,当我们使用服务器别名时,要求将 url 重定向到服务器名称,如下所示
http://example 扩展为 http://example.domain.com/StartPage/startpage.jsp
谁能帮我修改 vhost 文件以使其正常工作。
【问题讨论】:
标签: apache .htaccess redirect mod-rewrite vhosts