working on local setup . Found this problem while rewriting URL to look good I have department , category and products list ....when i click on one of the department the url is rewritten from
Project /index.php?departmentId=1 to
Project/deptname-d1
And it displays the associated categories with tat department the twist is when one of the category is selected server throws object not found The selected URL was not found on server the link on referring page seems to be wrong or outdated The URL before rewriting would be
Project/index.php?departmentId=1&CategoryId=2
The required format of url is Project /deptname-d1/catname-c2 The regex in htacess is something like this Options +FollowSymLinks RewriteEngine on RewriteBase /project RewriteCond %{THE_REQUEST} ^GET.*/index.(php|html?)\ HTTP RewriteRule ^(.)index.(php|html?)$ $1 [R=301,L] #rewrite rules for department RewriteRule ^.?-d([0-9]+)/page-([0-9]+)/?$ index.php? DepartmentId=$1&Page=$2[L] RewriteRule ^.?-d([0-9]+)/?$ index.php?DepartmentId=$1[L] #rules for category RewriteRule ^.-d([0-9]+)/^.-c([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&CategoryId=$2&Page=$3[L] RewriteRule ^.-d([0-9]+)/^.c([0-9]+)/?$ index.php?DepartmentId=$1&CategoryId=$2 [L] #rewrite rules for product Rewriterule ^.?-p([0-9]+)/?$ index.php?productId=$1
Before rewriting the following were the urls localhost/project/ for front page localhost/project/index.php?DepartmentId=x for department front page localhost/project/index.php?DepartmentId=x&page=zfor department pag localhost/project/index.php?DepartmentId=x&CategoryId=y for category front page localhost/project/index.php?DepartmentId=xCategoryId=y&page=z for category pages localhost /project/ProductId=Q These are the input Urls which are to be rewritten in the following form Localhost/project/ for front page localhost/project/department-name-dx/ for department front page localhost/project/department-name-dx/page-z/ for department pages localhost/project/department-name-dx/category-name-cy/ for category front localhost/project/department-name-dx/category-name-cy/page-z for category pages
Please note tat department and product related regex are working fine only the category page is acting weird can someone explain wats going wrong
RewriteRule Project/deptname-d(\d+)/?$ /index.php?departmentId=$1 [L]