I know not my .htaccess is working since it is showing the ErrorDocument 404 when it can’t locate a file.
I am trying to re-write the url so that domain.com/products/123 will become domain.com?product.php?productid=123
This is my .htaccess and it is not doing the trick. When I write domain.com/products/123 in the browser, I get the ErrorDocument 404.
RewriteEngine on
RewriteRule ^/products/([0-9]+)/$ product.php?productid=$1
ErrorDocument 404 /page404.php
What am I doing wrong?
Found the problem after a while.
This was the bugged code:
RewriteRule ^/products/([0-9]+)/$ product.php?productid=$1
Abadon was right about the / before products, but also there should be ? before the $. So this code will work like it should: