CodeIgniter Forums
Redirecting to SEO-friendly URL using form - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Redirecting to SEO-friendly URL using form (/showthread.php?tid=28166)



Redirecting to SEO-friendly URL using form - El Forum - 03-03-2010

[eluser]nyalex[/eluser]
I am building a local search directory. One that will allow users to search for a keyword (ex: dentist) and a location (ex: New York, NY) using two form fields.

It consists of two pages:

Page 1: The search form with only two text boxes (keyword & location) for searching.

Page 2: The results page that is a list of the relevant search results.

The problem is that the search results page doesn't list the search keywords within the landing URL. The query uses $this->input->post instead of $this->uri->segment(n).

Is there anyway to force the form on page 1 to redirect to the search results page with url_title(keyword) and url_title(location) in the URL with the current query logic?

Thanks again in advance.


Redirecting to SEO-friendly URL using form - El Forum - 03-03-2010

[eluser]nyalex[/eluser]
Is this possible?


Redirecting to SEO-friendly URL using form - El Forum - 03-03-2010

[eluser]danmontgomery[/eluser]
Code:
$keyword = url_title($this->input->post('keyword'));
$location = url_title($this->input->post('location'));
redirect('some/page/' . $location . '/' . $keyword);



Redirecting to SEO-friendly URL using form - El Forum - 03-18-2010

[eluser]angeal99[/eluser]
@noctrun

thanks for your code dude Smile