function drupal_encode_path

Encodes a Drupal path for use in a URL.

For aesthetic reasons slashes are not escaped.

Note that url() takes care of calling this function, so a path passed to that function should not be encoded in advance.


$path: The Drupal path to encode.

Related topics

3 calls to drupal_encode_path()
DrupalPublicStreamWrapper::getExternalUrl in includes/
Overrides getExternalUrl().
file_create_url in includes/
Creates a web-accessible URL for a stream to an external or local file.
url in includes/
Generates an internal or external URL.


includes/, line 635


function drupal_encode_path($path) {
    return str_replace('%2F', '/', rawurlencode((string) $path));

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.