Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
apache2 alias index.html到另一个目录_Apache_Mod Rewrite_Mod Alias - Fatal编程技术网

apache2 alias index.html到另一个目录

apache2 alias index.html到另一个目录,apache,mod-rewrite,mod-alias,Apache,Mod Rewrite,Mod Alias,我在服务器中有两个目录 /var/www/html/new-website/ /var/www/html/old-website/ 旧网站有index.html文件,而新网站没有此文件。它还有一个/blog目录 我想将请求指向根/和/index.html指向旧网站目录,并将所有其他请求指向新网站 我的配置是 <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/ww

我在服务器中有两个目录

  • /var/www/html/new-website/
  • /var/www/html/old-website/
旧网站
index.html
文件,而
新网站
没有此文件。它还有一个
/blog
目录

我想将请求指向根
/
/index.html
指向
旧网站
目录,并将所有其他请求指向
新网站

我的配置是

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/new-website/
        ServerName website.example.io

        Alias "/index.html" "/var/www/html/old-website"
        Alias "/blog" "/var/www/html/old-website/blog"

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

服务器管理员webmaster@localhost
DocumentRoot/var/www/html/new网站/
ServerName.example.io
别名“/index.html”“/var/www/html/old-website”
别名“/blog”“/var/www/html/old-website/blog”
选项索引跟随符号链接
允许超越所有
要求所有授权
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
除以下端点外,所有其他端点都正常工作

  • /
    的请求被重定向到
    index.html/
  • index.html/
    的请求正在加载适当的内容,但URL中添加了一个后续的
    /
  • 如何从URL中删除
    index.html/
    ,并将其视为根请求
    /