Remove id alias appending to confirmation page URL I have created a basic page in Drupal 7 that acts as a custom confirmation page for a web form. The url needs to be clean and static because it will be tracked by Google Adwords.

The problem is that an id is appended to the url, see example below. http://www.dynasty-autoglass.com/contact-confirmation?sid=230

The URL is supposed to end with only /contact-confirmation

How am I able to remove this id?

Thank you.
Option 1 (preferred)

This can be done with some code in a custom module.

You can use hook_form_alter to add an additional submit handler to every webform:

function YOUR_MODULE_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  // All webform id's start with webform_client_form so check for that
  if(substr($form_id, 0, 19) == 'webform_client_form') {
    $form['#submit'][] = 'my_webform_redirect';
  }
}


And then in the additional submit handler strip the query string form the URL:

function my_webform_redirect($form, &amp;$form_state) {
  unset($form_state['redirect'][1]);
}


$form_state['redirect'] is an array that consists of 2 parts. The first is the actual URL, so in this case it will be 'contact-confirmation'. The second part is the query string (sid=12), so all we need to do is unset it and it won't be appended to the URL.



Option 2

If you are tracking lots of pages over your whole site then it may be desirable to implement a solution that ensures that no query strings will appear anywhere on the site. Do bear in mind that this will break any functionality that depends on query strings. For this solution you need to put the following in your .htaccess file:

RewriteEngine On
RewriteCond %{QUERY_STRING} !="" #if there is a query string
RewriteRule ^(.*)$ /$1? [R=301,L] #remove query string


For more information on this technique there is a blog article here.