Cyber Week Deals! Save 80% on all Shared Hosting Plans & Locations - Starting from $1.99/mo

How to Address Moodle Error: Incorrect Access Detected

Updated on Oct 17, 2022

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 site is configured to work with example.com. The precise error message "Incorrect Access Detected" appears when you try to access it via www.example.com.

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 www.domain.com, where domain.com 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.example.com. 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