php - Need to hide id in my RewriteRule in .htaccess -


i have built custom business directory in php , i'm making urls human readable.

my url request getting business sub directories is:

http://.../new/business-subdirectory.php?cat=air-conditioners&cid=281 

so have written rule in .htaccess gives me pretty url

http://.../business-directory/air-conditioners/281 

since mysql queries working on ids, have pass id (281) in pretty url don't want in url.

i want pretty url be:

http://.../business-directory/air-conditioners/ 

here .htaccess rule:

rewriterule ^business-directory/(.*)/(.*)/?$ new/business-subdirectory.php?cat=$1&cid=$2 

one option have use sub directories names instead of ids... still wanna see have other options or not...?

waiting answers or suggestions :)

omer

as performing queries based on id passed in url. without changing code can not achieve looking.

best option have slug value in url, unique same id , need change queries based on that.

so if air-conditioners having id 281 need change query fetch data based on category slug , not using id.


Comments