'magento 2 rewrite url

I have static web site for example returns I have multi language shop setup. So for German it would be german/ruckgaben.

However when i user only ruckgaben it shows me 404, that is expected because its invalid url. However when i use returns and english/returns its showing me content(its the same but i want to be available on only one url). How can i force only english/returns to work ? Either by 404 on returns or redirect to english/returns. I try using magento 2 url rewrite system but i rewrite returns(request)->returns(target).



Solution 1:[1]

By looking at your issue, you might have to follow below steps to fix the issue

  1. Go to Magento admin -> Marketing Menu -> SEO & Search -> URL Rewrites
  2. Search for ruckgaben(404 page) url from url list and edit it
  3. Delete that url from click on delete button
  4. Add new url rewrite, in which from select drop down select url type like for category, for product , for cms page etc
  5. Select store which you want
  6. Add request path like ruckgaben in your case
  7. If you select create URL rewrite like for category, for product , for cms page then target path is filled automatically
  8. Now save the url rewrite
  9. And do reindex command and run the 404 URL

By following above steps, your -- issue should be resolved.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 PHP Team