CodeIgniter Forums
$config['enable_query_strings'] adding "?" to my URL - 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: $config['enable_query_strings'] adding "?" to my URL (/showthread.php?tid=53186)



$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-13-2012

[eluser]ibnclaudius[/eluser]
When I set $config['enable_query_strings'] to TRUE, it adds "?" to my URLs, for example:

http://localhost/bloompit/entrar
http://localhost/bloompit/?entrar

http://localhost/bloompit/entrar?next=http://localhost/bloompit/another-title
http://localhost/bloompit/?entrar?next=http://localhost/bloompit/?another-title

How can I fix it?


$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-13-2012

[eluser]InsiteFX[/eluser]
Turn off enable_query_strings



$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-13-2012

[eluser]ibnclaudius[/eluser]
But I need it because I'm using facebook-php-sdk.


$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-13-2012

[eluser]InsiteFX[/eluser]
Add this - ./application/config/config.php.
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%?=&.:_\-';

Add this - ./application/core/MY_Input.
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* ------------------------------------------------------------------------
* Created by phpDesigner 8.
* Date  : 6/27/2012
* Time  : 11:49:22 PM
* Author: Raymond L King Sr. - The Learn CodeIgniter Development Team.
* ------------------------------------------------------------------------
*
* Class Name
*
* ------------------------------------------------------------------------
* @package  Package  CodeIgniter
* @subpackage Subpackage libraries
* @category category name
* @author  Raymond L King Sr.
* @copyright Copyright (c) 2009 - 2012, Custom Software Designers, LLC.
* @link  http://www.example.com
* ------------------------------------------------------------------------
* To change this template use File | Settings | File Templates.
* ------------------------------------------------------------------------
*/

class MY_Input extends CI_Input {

/**
  * --------------------------------------------------------------------
  * Class variables - public, private, protected and static.
  * --------------------------------------------------------------------
  */

private $_ci;

// -----------------------------------------------------------------------

/**
  * _sanitize_globals()
  *
  * Some Workaround:
  *
  * 1. If you want to accept GET data in your controller’s index method.. have to use
  * - http://localhost/myapp/mycontroller/index/?possible=yes
  *
  * @access public
  */
public function _sanitize_globals()
{
  $this->allow_get_array = TRUE;

  parent::_sanitize_globals();
}

} // End of Class.


/* ------------------------------------------------------------------------
* End of file Name.php
* Location: ./application/libraries/Name.php
* ------------------------------------------------------------------------
*/

Add this ./ .htaccess.
Code:
php_value default_charset utf-8

Options FollowSymLinks
Options -Indexes
DirectoryIndex index.php

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]



$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-14-2012

[eluser]ibnclaudius[/eluser]
The problem persists, still adding "?" to my URLs.

./application/config/config.php

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%?=&.:_\-@';

./application/core/MY_Input

Code:
<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class MY_Input extends CI_Input
{
    public function _sanitize_globals()
    {
        $this->allow_get_array = TRUE;
        parent::_sanitize_globals();
    }
}

./.htacces

Code:
php_value default_charset utf-8

Options FollowSymLinks
Options -Indexes
DirectoryIndex index.php

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]



$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-14-2012

[eluser]InsiteFX[/eluser]
Turn off enable_query_strings, you do not need it with the code I gave you above.

And use REQUEST_URI Protocol.



$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-14-2012

[eluser]ibnclaudius[/eluser]
Thanks!


$config['enable_query_strings'] adding "?" to my URL - El Forum - 07-14-2012

[eluser]InsiteFX[/eluser]
I bought the CodeCanyon EasyMenu system and converted it to CI and that was how I ended up getting it to work after changing all the javascript url's. This letsme use drag and drop menu position changing in my backend dashboard.


Use CI's input->post and input->get

EasyMenu

Took me about two weeks to get it to work right LOL