0

I want to pass URL in GET param like this :

SITE URL/b16ee4f31e17df0d3af5?url=https%3A%2F%2Fwww.facebook.com%2F

I am using urlencode to escape characters, but I see 403 Error for this URL, because of some of the characters in the URL GET parameter in this case the dot character.

If I use CI3 function url_title, it will escape dot characters, but I need them because I need valid url in GET parameter.

How can I pass URL get parameter with in some cases with characters like . & ? \ and other characters which can be found in the standart URL ?

1

3 Answers 3

1

You can change $config['permitted_uri_chars'] in your config file

Leave blank to allow all characters -- but only if you are insane.

Also you can do this:

Step 1: $newurl = urlencode(base64_encode('http://google.com'));

Then you will have a string, pass that string as GET parameter and parse it back using:

$realUrl = base64_decode(urldecode($param1));

Where $param1 means the first param of your controller.

Step 2: add = to your $config['permitted_uri_chars'] in your config file

Sign up to request clarification or add additional context in comments.

Comments

1
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';

add the character what you trying to pass on GET Url. This configure is store on config.php of config folder.

Comments

-1

The url has already been encoded(that is if you just copied and pasted it from the address bar) so you can use it with further encoding

1 Comment

i meant #without further encoding. You can also urlencode() it on sending and urldecode() on receiving

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.