linux - moodle 重定向到 "Incorrect access detected"

标签 linux apache .htaccess moodle

如果我在浏览器中输入 moodle 的 url,我会看到重定向页面:

Incorrect access detected, this server may be accessed only through "http://lms.example.ir/moodle" address, sorry. Please notify server administrator.

但是自动重定向一直在尝试加载它。

-我放入了config.php文件

$CFG->wwwroot   = 'http://lms.example.ir/moodle';

-我把这段代码放在.htaccess

#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.lms.example\.ir [NC]
    RewriteRule ^(.*)$ http://lms.example.ir/$1 [L,R=301] 

为什么会这样?

最佳答案

您应该在 .htaccess 文件中使用 %{SERVER_NAME} 而不是 %{HTTP_HOST}。

关于linux - moodle 重定向到 "Incorrect access detected",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31635186/

相关文章:

c++ - 将 UTC tm* 转换为本地化 tm* 的跨平台方式?

json - Logstash apache2 未转换为 json

apache - 使用.htaccess动态重定向到子文件夹,不使用域名隐藏url中的子文件夹

linux - iptables 在 Ubuntu 服务器上存储规则的位置

mysql - shell 脚本 if 条件

linux - 通过替换 .so 文件更新 Apache 身份验证模块

apache - "make_sock: could not bind to address [::]:443"重启 apache 时(安装 trac 和 mod_wsgi)

authentication - 允许 IP 地址无需身份验证

apache - 访问日志 apache 和 htaccess

c - 为什么在执行不带 "%"的 printf 后打印字符 "\n"?