You need to url-encode each component in the query string.
The first parameter id=1
is fine, but the destination
parameter contains special characters used for delimiting uri components : /
, ?
, =
.
You can use urlencode()
or rawurlencode()
:
$node_alias = '/node/add/page?id=1&destination=' . rawurlencode('/admin/content?id=1')
There is a drupal way of doing this, using drupal_http_build_query()
(d7):
$path = current_path();
$params = drupal_get_query_parameters() + array('destination' => '/admin/content?id=1');
$query = drupal_http_build_query($params);
$node_alias = $path . '?' . $query;
See also urlencode vs rawurlencode?