Welcome Guest, Not a member yet? Register   Sign In
SEO friendly search filter using segment
#1

(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'
In my url i want to make it if the location and property type is set on 'any' it will look like this
Example.com/buy/house

PHP Code:
$routes->get('filter/(:segment)/(:segment)' 'Home::filter/$1/any/$2'
And if the location is available and not the type
Example.com/buy/tokyo

PHP Code:
$routes->get('filter/(:segment)/(:segment)' 'Home::filter/$1/$2/any'
Now my problem is that its not working as expected
Can someone please help me
Reply
#2

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')
// Home::filter($buy, $city, $house) 
Simple CI 4 project for beginners codeigniter-expenses
Reply
#3

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
Reply
#4

SEO friendly Smile URL without query string
Simple CI 4 project for beginners codeigniter-expenses
Reply
#5

(01-03-2024, 01:33 PM)ozornick Wrote: SEO friendly Smile URL without query string

Then almost no website is seo friendly in the world. How can the search results page be SEO friendly? The content is not clear or fixed, right?
Reply
#6

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB