How can I rewrite the following codeigniter url
localhost/test_project/pages/show_page/11
to
localhost/test_project/pages/11
and is it possible to further reduce like:
localhost/test_project/11
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should edit this file:
application/config/routes.php.Let’s assume you have a
pagescontroller and ashow_pagemethod with receives an id as a parameter (just as you said).your URL is like
localhost/test_project/pages/show_page/11I assume that the parameter is always a number, so using wildcards as described here you can add the following to your
routes.phpfile:So your URLs will be like
localhost/test_project/pages/3. This is like saying if anyone tried to visitlocalhost/test_project/pages/3, he/she actually meanslocalhost/test_project/pages/show_page/3.For urls like
localhost/test_project/3you can add this: