How to Address Moodle Error: Incorrect Access Detected

Updated on May 10, 2023

Moodle is a learning platform designed to provide educators, administrators, and learners with a single robust, secure, and integrated system to create personalized learning environments. There is a specific issue that might occur while using Moodle and reads, "Incorrect Access Detected." We'll briefly discuss the cause of this particular problem in this post, as well as a solution.

When Does the Error Occur?

The error message is caused by the way that Moodle is actually intended to operate. Your website is configured to work with a specific domain ( for example). The error appears when you try to access the website via www. (

Moodle immediately notifies you with a message and then leads you to the website URL you set during installation.

The Solution for Error: Incorrect Access Detected

The issue can be easily resolved following these steps:

Access your website on the server via FTP or directly through the File Manager service within your cPanel account:

Locate and access the config.php file of your Moodle website for editing.

Change the wwwroot variable and set it to, where is the actual domain that you are using for your website.

Locate and access the .htaccess file of your Moodle website for editing.

Enter the following lines of code in it:

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

The actions listed above will set up your website so that it can begin using www. You will still be automatically routed even if you try to access your website without the www prefix, but this time there won't be any notifications displayed. The actual reroute won't even be noticeable to you or your users.

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