首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache:没有匹配的DirectoryIndex

Apache:没有匹配的DirectoryIndex
EN

Server Fault用户
提问于 2018-09-27 04:33:40
回答 1查看 3.3K关注 0票数 1

我是apache的新手,我有以下目录结构:

代码语言:javascript
复制
html
|-- moodle
    |-- singapur
        |-- app
        |-- public
           |-- js
           |-- css
           |-- img
           |-- index.php

我需要从www.mywebpage.com/singapur重定向到www.mywebpage.com/singapur/public

位于文件夹.htaccess中的singapur是:

代码语言:javascript
复制
Options -Indexes

    Options -Multiviews
    RewriteEngine On
    RewriteBase /singapur/
    RewriteRule .* public/$1 [L]

位于文件夹.htaccess中的public是:

代码语言:javascript
复制
    Options -Multiviews
    RewriteEngine On
    RewriteBase /singapur/public
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

文件moodle.conf

代码语言:javascript
复制
        ServerName webpageexample.cl
        ServerAlias www.webpageexample.cl
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/moodle
        
             Options Indexes FollowSymlinks MultiViews
             AllowOverride All
             Order allow,deny
             allow from all
             Require all granted
        
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

但是,当我尝试从web浏览器访问webpageexample.cl/singapur时,我获得以下信息

代码语言:javascript
复制
Forbidden

You don't have permission to access /singapur/ on this server.

在apache日志中:

代码语言:javascript
复制
Cannot serve directory /var/www/html/moodle/singapur/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

谢谢

EN

回答 1

Server Fault用户

发布于 2018-09-27 04:53:54

您可以使用RedirectionMatch指令将Apache发送到其他地方。

代码语言:javascript
复制
RedirectMatch 301 ^(.*)$ http://www.anotherserver.com$1

单击这里获取更多知识。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/932874

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档