문제

RewriteCond %{REQUEST_URI} (.*)Products/(.*) [NC]
RewriteRule .* Products/viewproduct.php?category_name=%2 [L]

I am trying to Get category name but it shows viewproduct.php

도움이 되었습니까?

해결책

You can use this rule:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule Products/(.+)$ Products/viewproduct.php?category_name=$1 [L,NC,QSA]

Problem is that your rule is executing twice. 1st time for /Products/abc/ and 2nd time for `/Products/viewProduct.php/ URL since your pattern is matching both times. RewriteCond above will stop this behavior.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top