CentOS Apache重定向[关闭]

gwo2fgha  于 2023-10-23  发布在  Apache
关注(0)|答案(1)|浏览(143)

已关闭此问题为not about programming or software development。它目前不接受回答。

这个问题似乎不是关于a specific programming problem, a software algorithm, or software tools primarily used by programmers的。如果你认为这个问题与another Stack Exchange site的主题有关,你可以留下评论,解释在哪里可以回答这个问题。
2个月前关闭。
Improve this question
我试图有一个内部链接指向一个特定的文件夹在我的Apache服务器我已经通过我的DNS服务器创建了一个规则,以便当一个用户去“vgr.intranet”它指向我的Apache服务器(192.168.1.62)
话虽如此,以下是我到目前为止所做的:

  1. <VirtualHost *:80>
  2. ServerName http://vgr.intranet
  3. DocumentRoot /var/www/html/vgr/
  4. Redirect permanent / http://192.168.1.62/vgr/
  5. </VirtualHost>

到目前为止,它所做的只是在应该转到“/vgr/”文件夹的时候转到我的Apache服务器的根目录。
谢谢.

bwleehnv

bwleehnv1#

在/var/www/html/vgr/的根目录下可能有另一个vgr目录?
如果没有,@CBroe是正确的,重定向是没有用的,因为当你在正确的位置直接访问vgr.intranet时,vhost将加载。
根据您想要做的事情,文档根目录和重定向应该是一致的。

  1. <VirtualHost *:80>
  2. ServerName vgr.intranet
  3. DocumentRoot /var/www/html/vgr/
  4. </VirtualHost>

  1. <VirtualHost *:80>
  2. ServerName vgr.intranet
  3. DocumentRoot /var/www/html/
  4. Redirect permanent / http://192.168.1.62/vgr/
  5. </VirtualHost>

相关问题