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

  • SEARCH
  • Home
  • 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 7191811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:48:30+00:00 2026-05-28T19:48:30+00:00

Let me explain the situation before I ask the question. I have a site,

  • 0

Let me explain the situation before I ask the question. I have a site, domain.com. the page sub.domain.com requires a user to be logged in to access. If I allow access to sub.domain.com/login which provides a form whose action is domain.com/login, it sends the data to domain.com/login and redirects back to sub.domain.com/login like it should. However, if I try to access sub.domain.com (which requires authentication) it redirects to domain.com/login correctly, but doesn’t redirect back to sub.domain.com after logging in. I found the error to be that the redirect when not logged in wasn’t sending the referrer header. Is there a way to make it so that if a user tries to access a page on a subdomain that requires authentication, that it will redirect him to domain.com/login, then back to where he originally was?

  • 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-28T19:48:31+00:00Added an answer on May 28, 2026 at 7:48 pm

    Ok, it all had to do with routes. I finally was able to get it working by setting up a switch statement in my routes.php file:

    switch(Configure::read('subdomain'))
    {
         case 'subdomain':
              Router::connect('/login', array('controller'=>'users', 'action'=>'login'));
    }
    

    And set up my bootstrap like so:

    preg_match('/^(?:www\.)?(?:(.+)\.)?(.+\..+)$/i', env('HTTP_HOST'), $matches); 
    $subdomain = empty($matches[1]) ? false : $matches[1];  
    if( strlen($subdomain) > 0 && $subdomain != "www" ) 
    {
        if($subdomain == 'api')
            $_GET["url"] =  $subdomain . "/" . (isset($_GET["url"]) ? $_GET["url"] : ""); 
        Configure::write('subdomain', $subdomain);
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

let me explain my current situation i have a SharePoint site lets say it
Let me explain my situation. I have made a user control that contains an
Before you start laughing at such a simple question let me explain: I am
Before you say its a duplicate question, please let me explain (as I've read
Let me explain my question by posing a hypothetical situation. Lets start with a
Let me explain my situation, I have a list of checkboxes in a fieldset,
Let me explain the situation I have two tables: -One is to store the
My question might not be understandable enough, so let me explain the situation :
Let me explain my situation. Currently, I have a lot of applications running on
Imagine I have a situation where I need to index sentences. Let me explain

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.