I have a blog posts, and when an anonymous user visits it and and clicks the link "Login" or "Register" to post comment (under blog entry), then its url looks like this:


But I don't want that parameter of destination here. I just want a simple link like so:


Any suggestions?

3 Answers 3


Finally I got the solution by using hook_url_outbound_alter in my theme template. I tested it successfully.

function moon_url_outbound_alter(&$path, &$options, $original_path) {
 // here "moon" is my theme, use your own.
  switch ($path) {
  case 'user/login':
  unset( $options['query']['destination'] );

you could create your own block to easily accomplish this:

  • create a new block allowing Full HTML, then insert your own link to login / register
<a href="/login">Sign In</a> / <a href="/register">Register</a> to post comments
  • limit it's visibility to the content types you want, in the placement you want, and only show for anonymous users

  • use some css (or a preprocess function override if you want to get fancy) to hide the existing element

  • your idea is good @Geoff but this is not suitable solutoion in this situation. Because i will have to add this new block under every node types and also under each comment. So this is time killing and lenghty process !
    – WaQaR Ali
    Apr 22, 2015 at 9:39
  • setting up a block only takes a few minutes at most, and it only needs to be done once... If it's a lengthy process, you're probably doing something wrong
    – Geoff
    Apr 22, 2015 at 15:00
  • i like your last point "preprocess function override" this has realy helped me to solve my problem, thanks
    – WaQaR Ali
    Apr 23, 2015 at 5:39

Would the Login Destination module help?

  • sorry, this has not help me. This module just change destination after login but provide any help to finish destination parameter. Because that destination parameter gains value before login but this module start action after login. A simple rule also provide same functionality like this module but not according to my needs !
    – WaQaR Ali
    Apr 21, 2015 at 10:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.