Search code examples
apache.htaccessopencart2.x

htaccess RewriteRule not taking effect


I want Apache to internally redirect this URL to this. I am using .htaccess file.

http://inaden.dev:8888/products -> http://inaden.dev:8888/index.php?route=products/products Here is what I have tried but it is giving me 404

RewriteEngine On

    RewriteBase /
    RewriteRule    ^products/([0-9]+)/?$    /index.php?route=products/products    [NC,L]    # Handle product requests

Solution

  • The rule is targeting products/ plus some number and a trailing slash, it won't fire for just /products. So I fixed the problem by removing the number matching pattern. The working solution is

     RewriteRule    ^products/   /index.php?route=products/products    [NC,L]    # Handle product requests