1

I want to use a segment base URL and a query string URL with CodeIgniter at the same time, and in the same project, for example http://localhost/finance_new/login/logout and http://[::1]/finance_new/?c=login&m=logout.

When I set enable_query_string to true, it only works for the second pattern but not for the first.

How can I use both URLs?

I am using CodeIgniter version 3.0.

3
  • does it is working with localhost/finance_new/login/logout? Commented Jan 26, 2017 at 5:14
  • Try change $config['uri_protocol'] = 'REQUEST_URI'; to $config['uri_protocol'] = 'QUERY_STRING'; Commented Jan 26, 2017 at 6:15
  • duplicate of stackoverflow.com/questions/36947577/… "codeigniter how to enable segment base urls and query string url at the same time" Commented Jan 26, 2017 at 10:53

1 Answer 1

0

You probably forget to set base_url() in application/config/config.php.

Just set base_url() like this..

$config['base_url'] = 'http://localhost/finance_new/';

Then

$config['enable_query_strings'] = TRUE;
Sign up to request clarification or add additional context in comments.

6 Comments

I set base_url but it is not working..always it redirect to default controller
could you post your routes.php?
$route['default_controller'] = 'home'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE;
try 127.0.0.1 at the place of [::1].
Not working not working...i use my ip address 192.168.0.40/finance_new/configuration/edit_bank/241..also use 127.0.0.1 but not working
|

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.