Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4231110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:56:03+00:00 2026-05-21T01:56:03+00:00

is there a way in Kohana3 to reference the previous controller/action. Let me explain

  • 0

is there a way in Kohana3 to reference the previous controller/action.

Let me explain a little better:
I have a base controller which check if user is logged into the system using the Auth module.
If the user goes to a page which he is not allowed to view, he gets redirected to the logins screen.

Now I would like (when he sings in) to go back to the page which triggered the login controller.
I wanted to pass it as an URI segment, but the problem is that the controller can contain “/” characters.

Example:

  • user goes to mysite.com/user/profile
  • he gets redirected to mysite.com/login (need to pass user/profile)
  • after successful login user gets redirected back to mysite.com/user/profile
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T01:56:04+00:00Added an answer on May 21, 2026 at 1:56 am

    I do this by constantly updating a session value for users who are not logged in.

    Session::instance()->set('redirect', Request::instance()->uri());
    

    Then, after a successful login, you can redirect like this:

    Request::instance()->redirect(Session::instance()->get('redirect', URL::base());
    

    I haven’t tested the code, but the concept is there. If no value is set then proceed to redirect to the home page.

    Please make sure you’re careful and validate the redirect URL. It shouldn’t be, but since we’re dealing with user data there’s always a slight chance something bad might come back. The last thing you want is to be redirected to a virus infested website after you’ve logged in.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to check whether a file is locked without using a
I have a controller called articles , which creates the articles model which gets
Is there way in next piece of code to only get the first record?
is there way thats i can preselect an item when the page loads or
Is there a way to enforce constraint checking in MSSQL only when inserting new
Is there a way to find the name of the program that is running
Is there a way to hide radio buttons inside a RadioButtonList control programmatically?
Is there a way to find the number of files of a specific type
Is there a way to take over the Entity Framework class builder? I want
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.