4

I have the following text

Car/red

i want it to be sent withing the url ex:

http://ii/search/index/search/Car%2Fred/page/2

but doing so gives the "Search" query string only the "car" and ignore the "red" part how can we encode the slash so in can be sent within the URL ?

7
  • What you show should work. What server are you using and what does your rewrite method look like? Commented Mar 15, 2012 at 10:48
  • i am running php on fedora and the $_GET["string"] gets only the first part Commented Mar 15, 2012 at 10:49
  • You are rewriting the URL. What do the rules look like? Commented Mar 15, 2012 at 10:50
  • i just try echo $_GET["search"] and i get car ... Commented Mar 15, 2012 at 10:54
  • 4
    The URL you show above does not contain a "search" parameter, does it? So some rewriting is taking place somewhere. This is impossible to answer without getting some more relevant information. Commented Mar 15, 2012 at 10:58

1 Answer 1

3

If you're using urlFormat 'path' you're not able to submit slashes in parameters, because Yii can't distinguish between them. See Qiang's comment.

As a workaround set:

'urlManager'=>array(
  'appendParams'=>false,
),

Your URL should look like this then:

http://ii/search/index?search=Car/red&page=2

You may also add rewrite rules for having the page param in a nicer way in the URL.

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

Comments

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.