Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Redirect on login to current page. Redirector Page. Variable URL on Redirector?


Go to End


2009 Views

Avatar
forumq42

Community Member, 18 Posts

6 April 2013 at 1:57pm

Edited: 06/04/2013 2:01pm

So we have multiple sites.

The behavior of one has a footer template so that a Login link appears at the bottom of every page. After successful login, the user is redirected to a logged in version of the page they clicked the login link from.

The <a href> in the footer.ss looks like:
<a href="Security/login?BackURL=$UrlLink" title="Login">Login</a>

So the page to return to when the page is rendered has been dynamically generated. So it will be http://mysite.com/admin/show/<whatever_page#_currently_on>;

This works quite well.

However another site we have hasn't got the login links set up that way, but rather there is a 'Login' page within the site tree of the CMS that is a Redirector Page. The page it is set to go to is basically our home page. Under the 'Behavior' tab the ' Show in Footer Menu?' is checked.

On the Redirector Page under Content -> Main tab it looks like:

This page will redirect users to another page:
- Redirect to
- - Other website URL
- - - mysite.com

So that behavior makes sense. However it would be much preferable to get redirected after the login to the page one clicked the login link from.

My question is, from within the CMS, on the redirector page, is their a way to redirect to a dynamically generated page? So the link ends up dynamically generated to correspond to whatever page you are on?

So it looks like:

This page will redirect users to another page:
- Redirect to
- - Other website URL
- - - http://mysite.com/admin/show/<whatever page # currently on>

I'm trying permutations of:
https://mysite.com/Security/login?BackURL=%2Fhome

However I just end up back on the home page after login.

When I use:

https://mysite.com/Security/login?BackURL=$UrlLink

the result is a white page in the browser displaying just this line:

The action '$UrlLink' does not exist in class Security