---
schema_version: "1"
id: f91e03b5e01e45e23d9aba25b1663f7394c1454b56c20b7d0e25df48ce317d02
title: getUrl()
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_System_PageReference_getUrl.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_System_PageReference_getUrl.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 86562728c60e0d9b1f7d73eb480da5c70690bde08e103b49b9d0714991824168
description: Returns the relative URL associated with the PageReference when it was originally defined, including any query string parameters and anchors.
---
# getUrl()

Returns the relative URL associated with the PageReference when it was originally defined, including any query string parameters and anchors.

## Signature

public String getUrl()

## Return Value

Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")