Reputation: 21
I'm new in CodeIgniter and have a problem with URL
. When I open my URL like www.abc.com/france
it's working fine but when URLs comes like www.abc.com/united_state
the page open but all contents of page not shown properly. Also pagination not work(only single page shown). My controller code is
$searchkey =$this->uri->segment(3);
$searchkey = urldecode(str_replace('_',' ',$searchkey));
$checkin =$this->uri->segment(4);
$checkout = $this->uri->segment(5);
$newkey=$this->uri->segment(5);
}
if(preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $checkin) && preg_match('/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/', $checkout))
{
//echo "hello";
$last1=$last1+2;
switch($last1)
{
case 5:
$searchkey=$this->uri->segment(3);
$column = "CountryName";$master = "country";$master2 = "CountryName";
$getdata = $this->searchdata_model->get_listing_data_list($column,$searchkey,$checkin,$checkout,$master,$newkey);
$latest_listing = $this->searchdata_model->get_lastest_properties($searchkey,$master2);
$data['latest_listing'] = $latest_listing;
break;
I think the problem is in preg_match function.
Upvotes: 0
Views: 565
Reputation: 665
Allow the underscore character in config/config.php
file
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';
Upvotes: 1