0

I'm unable to route the following URL to a specified URI segment in CodeIgniter.

I want to route this URL

http://192.168.10.225/bachan/view/wholesale_detail/test-property/155454

to:

http://192.168.10.225/bachan/wholesale_detail/test-property/155454

in CodeIgniter 3x.

I have implemented below code but it doesn't work as expected:

$route['wholesale_detail/(:any)']="wholesale_details/$1";

in routes.php file.

1
  • noone dared to answer..very sad Commented Feb 22, 2017 at 6:52

2 Answers 2

3

Try this:

$route['bachan/([a-z]+)/([a-z]+)/(:num)'] = 'bachan/view/$1/$2/$3';

In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to. In the above example, if the literal word “bachan/wholesale_detail/test-property/123” is found in the the URL, the “bachan” class and the “view” method are instead used.

Sign up to request clarification or add additional context in comments.

2 Comments

could he? I'm sure he could do a lot of things. Expand on your answer, provide what it is he could do.
While this might be a valuable hint to solve the problem, a good answer also demonstrates the solution. Please edit to provide example code to show what you mean. Alternatively, consider writing this as a comment instead.
-1

Use this:

$route['bachan/wholesale_detail/test-property/(:any)'] = 'wholesale_details/$1';

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.