I need to pass some encrypted value through URL. Is there any way to avoid some characters such as slash (/) in the value we are getting after encryption? Because in codeigniter, character such as slash is used for separating parameters in the URL. Please note that i don't want any suggestion to don't pass the encrypted string in URL :)
Use the PHP urlencode function after encryption: http://php.net/manual/en/function.urlencode.php and use urldecode in the script that's processing the GET data. 
class MY_Encrypt extends CI_Encrypt
{
    function encode($string, $key="", $url_safe=TRUE)
    {
        $ret = parent::encode($string, $key);
        if ($url_safe)
        {
            $ret = strtr(
                    $ret,
                    array(
                        '+' => '.',
                        '=' => '-',
                        '/' => '~'
                    )
                );
        }
        return $ret;
    }
    function decode($string, $key="")
    {
        $string = strtr(
                $string,
                array(
                    '.' => '+',
                    '-' => '=',
                    '~' => '/'
                )
            );
        return parent::decode($string, $key);
    }
}
-
$key = $this->config->item('encryption_key');
$outboundlink = urlencode( $this->encrypt->encode($segment, $key, TRUE) );
$inboundlink  = rawurldecode( $this->encrypt->decode( $segment, $key) );
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With