Custom Clean URL

Local plugins ::: local_customcleanurl
Maintained by Santosh Thapa Magar
Customcleanurl help to convert the moodle url in more user readable format url. It also provide the option to redirect old URL into new/next URL.
Latest release:
27 sites
36 downloads
6 fans
Current versions available: 2

Custom Clean URL

Customcleanurl main idea is to convert the moodle url in more user readable format and SEO friendly url. Also provide custom url define for existing moodle url and 404 page template. It also provide the old url redirect to new/next url.

For Example:

  1. Course View Page URL your_domain/course/view.php?id=ID => your_domain/course/course_shot_name
  2. Course Category Page URL your_domain/course/index.php?categoryid=ID => your_domain/course/category/ID/category_name
  3. Course Edit Page URL your_domain/course/edit.php?id=ID => your_domain/course/edit/course_shot_name
  4. User Profile URL your_domain/user/profile.php?id=ID => your_domain/user/profile/username
  5. Other as defined like: 
    • your_domain/mod/page/view.php?id=11 => your_domain/about-us

Modify .htaccess file

Plugin require modifcation of the .htaccess file for redirect, For this we need to add the following rules:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /local/customcleanurl/route.php [L]
ErrorDocument 403 /local/customcleanurl/404.php
ErrorDocument 404 /local/customcleanurl/404.php

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Santosh Thapa Magar (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

Show comments
  • Plugins bot
    سومر, 2 سيپٽمبر 2024, 7:40 PM
    Approval issue created: CONTRIB-9678
  • Ievgenii Vasiuk
    اربع, 7 جنوري 2026, 4:40 AM
    Hi Santosh,
    Thanks for this great plugin.
    Please advise how to make this plugin working for Moodle 5.1 - I'm getting Error in plugin settings:
    "Customcleanurl route integration failed. Check your .htaccess file and update it according to the README or by adding the rules provided below." - I've added required settings to .htaccess
    I thought that root-cause was changed folder structure at 5.0 where plugins moved into folders like /public/local, and even tried to adjust code to have path /public/local.. instead of /local/... , but still have the problem.
  • Ievgenii Vasiuk
    اربع, 7 جنوري 2026, 5:58 AM
    Update: I've found and fixed the root-cause of my problem - in my case .htaccess was ignored because of Nginx,
    Instead, I had to the rewrite at server block of existing Nginx config try_files line with this, and all works like a charm:

    # Clean URL routing via customcleanurl
    try_files $uri $uri/ /local/customcleanurl/route.php?$query_string;
    index index.php index.html;
Please login to post comments