1

Currently we have a route called /products. On this route there is a SPA active which handles the routes after /products. To ensure that people don't get a 404 when directly typing in a route like /products/product-01 (because that page officially doesn't exist in Craft). We've setup a redirect (.htaccess) from /products/.* back to /products where the application handles the routing.

In Craft this seem to not work and give a 404. In case we make the base url /en/products a level deeper, there is no issue. So for example www.domain.com/en/products/products-01 doesn't give this issue while www.domain.com/products/products-01 does.

Anyone have any experience with this?

2
  • 1
    Sounds like your redirect rule might just be incorrect. Can you post the .htaccess rule? Also, what's the base URL of your site in the settings? Is en the primary site?
    – MoritzLost
    Commented Aug 1, 2023 at 13:16
  • @MoritzLost see below RewriteRule ^products/.* /products [L]
    – Kenneth
    Commented Aug 2, 2023 at 6:34

1 Answer 1

1

I solved the issue by adding custom routes to our Craft CMS install instead of using the .htaccess. Actually a better solution since we do not need .htaccess

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.