我是apache的新手,我有以下目录结构:
html
|-- moodle
|-- singapur
|-- app
|-- public
|-- js
|-- css
|-- img
|-- index.php我需要从www.mywebpage.com/singapur重定向到www.mywebpage.com/singapur/public
位于文件夹.htaccess中的singapur是:
Options -Indexes
Options -Multiviews
RewriteEngine On
RewriteBase /singapur/
RewriteRule .* public/$1 [L]位于文件夹.htaccess中的public是:
Options -Multiviews
RewriteEngine On
RewriteBase /singapur/public
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]文件moodle.conf:
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时,我获得以下信息
Forbidden
You don't have permission to access /singapur/ on this server.在apache日志中:
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谢谢
发布于 2018-09-27 04:53:54
您可以使用RedirectionMatch指令将Apache发送到其他地方。
RedirectMatch 301 ^(.*)$ http://www.anotherserver.com$1单击这里获取更多知识。
https://serverfault.com/questions/932874
复制相似问题