Improving SEO with User-Friendly URLs in Open edX

Dear Open edX community,

We recently set up our LMS using the Open edX Nutmeg release, and our platform is now live and publicly accessible. To enhance our visibility in Google search results, we are working on SEO improvements.

Our SEO team has identified the following areas for improvement:

  1. Course About Page URL:
  1. Courseware Page URL:

Why is this important?

We seek guidance on the following:

  • What is the best approach to modifying the Course About and Courseware page URLs?
  • We prefer not to make extensive customizations to the core Open edX code. Are there any alternative solutions?

Thank you in advance for your help.

1 Like

Recently I have been handling this problem myself, so leaving here my solution in case it will be helpful for someone in the future.

There is a patch caddyfile-lms that can be used to modify Caddy settings and there you can define rules for internally rewriting your URLs. It’s not gonna be a client redirect, it’s gonna be an internal rewrite so this will work for SEO

Here is the tutor plugin that I created to modify the Caddy config. Here you can add other rules as well, Caddy documentation is pretty extensive on that

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
    (
        "caddyfile-lms",
"""

# replace old urls with non-existing urls to show 404 error from Django
@oldcourselinks {
   path /courses/course-v1:*
   not path_regexp \/courses\/course-v1:(.*)\/.+
}
route @oldcourselinks {
    rewrite * /this-url-doesnt-exist
}

route /courses/* {
    uri path_regexp "\/courses\/([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)" "/courses/course-v1:$1+$2+$3"
}

"""
    )
)```
1 Like