diff --git a/my/index.php b/my/index.php
index 3d1e7d3a3e0..5721d8dc30b 100644
--- a/my/index.php
+++ b/my/index.php
@@ -18,7 +18,7 @@
print_header($mymoodlestr);
notice_yesno(get_string('noguest', 'my').'
'.get_string('liketologin'),
- $wwwroot, $_SERVER['HTTP_REFERER']);
+ $wwwroot, $CFG->wwwroot);
print_footer();
die();
}