How do I convert drupal_goto to 301? Right now I have a redirect in my code:

drupal_goto($path);


Per the documentation drupal_goto defaults to a 302 redirect. I want a 301.

However, when I put in:

drupal_goto($path, $http_response_code = 302);


It gives me an error:


  Argument 2 passed to drupal_goto() must be of the type array, integer given,


But if I try something like:

drupal_goto($path, array $options = array(), $http_response_code = 302);


...I get this error:


  Unexpected '$options'


How can I properly change drupal_goto into a 301 redirect?
Looks like you're mistaking the function definition for an implementation example.

The function definition describes the arguments to use, but it's not a literal example of how to call it.

So when you want to use the drupal_goto() function, instead of this:

drupal_goto($path, array $options = array(), $http_response_code = 302);


It should look more like this:

drupal_goto($path, array(), 301);