SEO friendly search filter using segment |
01-02-2024, 09:02 AM
(This post was last modified: 01-03-2024, 10:38 AM by ozornick. Edit Reason: Smiles off )
I am having trouble with the order of segment as param
I want to make my url look like this Example.com/buy/tokyo/house I want to use that url to and make it as param But my problem is that PHP Code: $routes->get('filter/(:segment)/(:segment)/(:segment)' , 'Home::filter/$1/$2/$3') Example.com/buy/house PHP Code: $routes->get('filter/(:segment)/(:segment)' , 'Home::filter/$1/any/$2') Example.com/buy/tokyo PHP Code: $routes->get('filter/(:segment)/(:segment)' , 'Home::filter/$1/$2/any') Can someone please help me
You can't make different options for the same router.
One solution would be to insert replace as ALL PHP Code: $routes->get('filter/(:segment)/all_cities/(:segment)' , 'Home::filter/$1/all_cities/$2')
Simple CI 4 project for beginners codeigniter-expenses
Why don't you use form method="get" and you will have a url like
mywebsite.com/listings?listing_type=buy&city=all&property_type=house
SEO friendly URL without query string
Simple CI 4 project for beginners codeigniter-expenses
It seems like you're running into some trouble with the order of segments in your URL routing. Have you tried rearranging your route definitions? Maybe prioritize the more specific routes before the general ones. Also, double-check that your route patterns match the URL structure you're aiming for. & make sure everything lines up correctly could help solve the problem
|
Welcome Guest, Not a member yet? Register Sign In |