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 3879854
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:46:31+00:00 2026-05-19T22:46:31+00:00

On my web site I would like to have several sub-domains. Files that create

  • 0

On my web site I would like to have several sub-domains. Files that create context for a given sub-domain are stored in corresponding sub-directory.

Sometimes I need to link to the files that do not belong to the sub-domain.

For example, on my “subdomain1.mysite.org” I have a link to “www.mysite.org/login.php”. The “login.php” is stored in the directory that contains all subdirectories corresponding to the sub-domains.

If I make the link to the “www.mysite.org/login.php” in this way: href='../login.php', it does not work. Because browser tries to access “subdomain1.mysite.org/../login.php”. To solve this problem I make the link in this way: href='http://www.mysite.org/login.php' but I think that in this way I cannot pass my session variables to the new page (can it be the case?).

So, my problem is that I cannot find a way to pass session variables to the page that is located in the parent directory (or to the page that is located on another domain). Does anybody know how this problem can be solved?

ADDED

As recommended, I tired to use session_set_cookie_params to solve the problem. But I still cannot manage to get the desired result. In more details I do the following:

I have in the index.php file that generates content for subdomain1.mysite.org I use the following code:

session_set_cookie_params(24*60*60,'/','.mysite.org');
session_start();
$_SESSION['page'] = $PHP_SELF;

Than later, in the same file I make a link to one of my pages (I think problem can be here). I create the link in the following way:

href='http://www.mysite.org/login.php'

In the login.php file I have the following code:

session_set_cookie_params(24*60*60,'/','.mysite.org');
session_start();
print "a".$_SESSION['page']."b";

As the result there is nothing between “a” and “b”. So, I still cannot pass the session variables from one page to another one. Does anybody know what I am doing wrong?

ADDED 2
I have to say that my problem is solved if I add the following line:
session_name("some_name");

before the

session_set_cookie_params.

  • 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-19T22:46:32+00:00Added an answer on May 19, 2026 at 10:46 pm

    In PHP INI you can set the session domain to “.mysite.org” then you should be able to share the session between multiple domains. The relevant variable is:

    session.cookie_domain

    You can also set it inside your script with the session_set_cookie_params() function.

    Edit – I should note this only works if your subdomains are on the same server (which looks like they are).

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

Sidebar

Related Questions

I have one web site in IIS, and I would like to have version
I have a web site and a web service and I would like to
Recently, I found several web site have something like : Recommended for You, for
I have several different implementations of a trait that I would like to test,
I have a few pages on my asp.net website that I would like to
I have a website that uses flash. I would like to convert the website
I have an ASP.NET web site that has a entities version 4.0 DAL. I
I have several web pages containing tables, for which I'd like to have line-borders
I have read several articles regarding templates for web site content. They all seem
I would like to design a web app that allows me to sort, browse,

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.