Thursday, 22 August 2013

URL redirection with htaccess and categorizing them

URL redirection with htaccess and categorizing them

Im having little knowledge on htaccess files and its usage,Im using linux
server with apache on PHP but in my current project I have 4 types of urls
1) domain.com/display.php?content=page&id=2
2) domain.com/display.php?content=category&id=2
3) domain.com/display.php?content=album&id=2
4) domain.com/display.php?content=image&id=2
now i want the same kind of URL for all these 4 like "domain.com/id" so my
plan is to pass like
1) domain.com/display.php?content=page&id=2 => domain.com/2-p
2) domain.com/display.php?content=category&id=2 => domain.com/2-c
3) domain.com/display.php?content=album&id=2 => domain.com/2-a
4) domain.com/display.php?content=image&id=2 => domain.com/2-i
so based on the parameter on last(p/c/a/i) i need to differentiate the
content in htaccess, so can some one assist me how to achieve this?

No comments:

Post a Comment