• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
$config['enable_query_strings'] adding "?" to my URL

#1
[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?

#2
[eluser]InsiteFX[/eluser]
Turn off enable_query_strings

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

#4
[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]

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

./application/config/config.php

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

./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]

#6
[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.

#7
[eluser]ibnclaudius[/eluser]
Thanks!

#8
[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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.