How to Address Moodle Error: Incorrect Access Detected

Updated on Jun 11, 2019

The reason for the Error message is the actual way Moodle is designed to work. It looks like your website is set to work with:

> domain.com

and this is the reason why when you attempt accessing it via:

> www.domain.com

Moodle automatically displays a message to notify and then redirect you to the URL you have specified for your website during the installation. However, this can be easily resolved, following these steps:

1. Access your website on the server via FTP or directly through the File Manager service within your cPanel account.
2. Locate and access the config.php file of your Moodle website for editing.
3. Change the wwwroot variable and set it to www.domain.com, where domain.com is the actual domain that you are using for your website.
4. Locate and access the .htaccess file of your Moodle website for editing.
5. Enter the following lines of code in it.

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Now, the steps above will configure your website to start working with www.domain.com. Even if you attempt to access your website without the www prefix, you will be automatically redirected, but this time without any messages on the screen. You and your users will not even notice the actual redirect at all.

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

SSD Cloud Hosting

  • Free Domain Transfer
  • 24/7 Technical Support
  • Fast SSD Storage
  • Hack-free Protection
  • Free Script Installation
  • Free Website Transfer
  • Free Cloudflare CDN
  • Immediate Activation
View More