title: How to encode a URL as a CakePHP parameter
body: <p>I would like to create a bookmarklet for adding bookmarks. So you just click on the <code>Bookmark this Page</code> JavaScript Snippet in your Bookmarks and you are redirected to the page.</p>
  
  <p>This is my current bookmarklet:</p>
  
  <pre><code>"javascript: location.href='http://…/bookmarks/add/'+encodeURIComponent(document.URL);"
  </code></pre>
  
  <p>This gives me an URL like this when I click on it on the Bookmarklet page:</p>
  
  <pre><code>http://localhost/~mu/cakemarks/bookmarks/add/http%3A%2F%2Flocalhost%2F~mu%2Fcakemarks%2Fpages%2Fbookmarklet
  </code></pre>
  
  <p>The server does not like that though:</p>
  
  <pre><code>The requested URL /~mu/cakemarks/bookmarks/add/http://localhost/~mu/cakemarks/pages/bookmarklet was not found on this server.
  </code></pre>
  
  <p>This gives the desired result, but is pretty useless for my use case:</p>
  
  <pre><code>http://localhost/~mu/cakemarks/bookmarks/add/test-string
  </code></pre>
  
  <p>There is the CakePHP typical mod_rewrite in progress, and it should transform the last part into a parameter for my <code>BookmarksController::add($url = null)</code> action.</p>
  
  <p>What am I doing wrong?</p>