I am using custom functionality for the Drupal URL topic shown in the discourse
site.
When a user visits the old URL of the Drupal site in a web browser, the system first checks in custom routes. It either ignores certain specified URLs as mentioned in custom routes, or it goes to the ‘custom_redirect’ function. In the ‘custom_redirect’ function, it finds the topic in Discourse and redirects the browser to that link.
If you’re trying to get drupal URLs to 301 to the proper Discourse topic then you want to use permalink redirects and probably permalink normalizations.
If you used an import script, it should have created permalinks, which you can see at /admin/customize/permalinks. If they aren’t working then you can use a permalink normalization to fix them up.