1

I am developing a multilingual site in Drupal 8. I added content in Turkish and I didn't create any translation for that node.
I managed to redirect user to the path alias. For example, when users visit https://example.com/tr/node/123, they are redirected to https://example.com/tr/custom-node-in-turkish.

When users visit https://example.com/node/123 or https://example.com/ar/node/123, they should be redirected to the 404 page.

How can I achieve this in Drupal 8?

1

2 Answers 2

0

You could add the redirect to the .htaccess file.

Redirect 301 /ar/node/123 /page-not-found
1
  • What about for those who are not using Apache, like site running on Nginx, IIS, etc?
    – Gulok
    Commented Jun 22, 2021 at 23:06
0

How did you managed to redirect users to the page alias? Maybe you could use:

throw new \Symfony\Component\HttpKernel\Exception\NotFoundHttpException();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.