Custom route ignore few url from discourse


I am trying to ignore specific URLs on this custom route using the code below.
(routes.rb files)

get '/*path' => 'static#custom_redirect', constraints: lambda { |request| !request.path.include?('/preferences/' ) || !request.path.include?('/custom_sso_login/') || !request.path.include?('/t/' ) || !request.path.include?('/admin/') || !request.path.include?('/singup') || !request.path.include?('/login')}

“It’s not working as expected. Do you have any experience dealing with this issue?”

Hi :slight_smile:

What is the context of what you’re trying to achieve?

hi @Canapin

I am using custom functionality for the Drupal URL topic shown in the discourse

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.

I am not using permalinks in discourse

My code is working for old site posts URL redirect to discourse topic or posts

But with this code they block some URL like login , signup, other forms

get ‘/*path’ => ‘static#custom_redirect’, constraints: lambda { |request| !request.path.include?(‘/preferences/’ ) || !request.path.include?(‘/custom_sso_login/’) || !request.path.include?(‘/t/’ ) || !request.path.include?(‘/admin/’) || !request.path.include?(‘/singup’) || !request.path.include?(‘/login’)}

You have some idea what I am missing !!