Reputation: 1
How to create uniq
rewrite rule for both url
index.php?controller=cname&task=tname&id=10
index.php?controller=cname&task=tname&page_id=20
i want to create link
cname/tname/10
cname/tname/20
both task is same but variable is different (id or page_id)
Thanks
Upvotes: 0
Views: 64
Reputation: 143906
You can't, because as far as these two goes:
cname/tname/10
cname/tname/20
there's no difference. How do you know when cname/tname/10
is referring to page_id=10
? as opposed to id=10
?
Alternatively, you can add another identifier to differentiate them:
cname/tname/10
cname/tname/p20
This makes it much simpler:
RewriteRule ^([^/]+)/([^/]+)/([0-9]+)/?$ /index.php?controller=$1&task=$2&id=$3
RewriteRule ^([^/]+)/([^/]+)/p([0-9]+)/?$ /index.php?controller=$1&task=$2&page_id=$3
Upvotes: 1