.htaccess:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^/category/([0-9]+)/?$ /category.php?category_id=$1 [NC,L]
I put the file in:
localhost/.htaccess
“category.php” page is in:
localhost/website/category.php
I tried:
localhost/website/category/4/
But it said:
The requested URL
/website/public/category/5/ was not
found on this server.
BTW, I tested .htaccess with another simpler rule and it was working.
First of all:
So in case of the document root directory, remove the leading
/from the pattern:Secondly, since your base path is actually
/website/and not/, change the base path withRewriteBase:Note that this base path applies to all rules in this .htaccess file. So you rather might want to change just the particular rules, for example: