subdomain

PHP setcookie() for domain but NOT subdomains

廉价感情. 提交于 2019-11-29 09:30:18
问题 Is there any way to set a cookie that is not readable on subdomains? In other words, have the cookie available on domain.com , but not www.domain.com or xyz.domain.com . //this is what i'm "intending"... setcookie($name,$value,$expires,'/','domain.com'); //however, this is how it behaves: setcookie($name,$value,$expires,'/','.domain.com'); The reasoning: I'm setting up a static CDN on a subdomain and don't want the user session cookies going back and forth for every image, css file, js file,

PHP session shared with subdomain

依然范特西╮ 提交于 2019-11-29 08:56:57
I have read many forums (including this one) about passing session variables between subdomains, and I can't get this to work. Can someone explain what I am missing? Step 1 In the php.ini file: session.cookie_domain = ".mydomain.example" Verified with phpinfo() that I am using the right php.ini file Step 2 In page at www.mydomain.example set a session variable $_SESSION['a'] , verify that it appears by calling it on the next page (it does). Click link to sub.mydomain.example . Step 3 Page at sub.mydomain.example checks if session variable is set using: $a = $_SESSION['a']; if(!isset($_SESSION[

Pointing a subdomain to a subfolder using .htaccess

淺唱寂寞╮ 提交于 2019-11-29 08:44:45
My webhost automatically forwards all requests to *.mydomain.com to the toplevel domain mydomain.com. I wanted to map any subdomain to a specific folder on my toplevel domain. i.e. sub.example.com must be mapped to example.com/someFolder ( without change in the address bar). After digging around on the net, I came up with this: RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.)?[^.]+\.example\.com.*$ RewriteRule (.*) http://example.com/myfolder/$1 [L] This seems to work well, except for one problem: When I go to the URL sub.example.com, the URL in the address bar changes to

ASP.NET MVC Subdomains

给你一囗甜甜゛ 提交于 2019-11-29 08:40:35
问题 I have hosting and domain like that: www.EXAMPLE.com I've created few subdomains like that: www.PAGE1.EXAMPLE.com www.PAGE2.EXAMPLE.com www.PAGE3.EXAMPLE.com ... etc... All of these subdomains point to one and the same ASP.NET MVC 5 Application. I want to make system which will load data depending of subdomain. Example: I have Article object which could be a Auto Review or Game review or Book Review etc... I would like to www.auto.example.com load data where type of article is Auto, to www

How to read main cookie from the sub domain with an existing sub domain cookie in PHP?

你。 提交于 2019-11-29 07:22:57
I need to use main domain cookies for my sub domains as with higher priority when both sub and main domain cookies exists. The problem is when I'm on sub.domain.com and there exist cookies for sub.domain.com .domain.com The PHP global $_COOKIE contains $_COOKIE['data'] == 'sub.domain.com' . I would like to check if there is also a .domain.com cookie and use it. How do I read the main cookie when I'm on a sub domain with an existing sub domain cookie? It looks like the gist of your issue is reading a cookie set in domain.com from sub.domain.com. Add session.cookie_domain = .domain.com to your

htaccess subdomain redirct with last url parameter

爱⌒轻易说出口 提交于 2019-11-29 05:16:58
I want to write a .htaccess file for redirecting my subdomains and URL's last variable to a new location. Here is what I want to do: http(s)://abc.example.com/books I want my internal URL to be like: http://example.com/?name=abc&type=books I have already gotten the subdomain redirect to work but I am not able to do subdomain with variable in last part of URL. How can I accomplish this? This should do what you want: RewriteCond %{HTTP_HOST} ^(.+).example.com RewriteRule ^(.*)% http://example.com/?name=%1&type=$1 [R,L] The "%1" means use the first capture group from the RewriteCond above.

Apache subdomain redirect into Tomcat

元气小坏坏 提交于 2019-11-29 04:13:03
问题 I'm pretty new to Apache HTTP, and sysadmin-ing in general, so i have this question I have a domain (www.doamin.com) with an Apache listening to port 80, also I have an Apache Tomcat on the same domain configured to port 8080. Is there a way to configure a subdomain (i.e, tomcat.domain.com) so it will redirect into my tomcat specific application, so user can access applications through app1.domain.com and app2.domain.com (and it will be served by Tomcat)? I've seen a lot of mentioning to mod

.htaccess Redirect Subdomain to External URL

∥☆過路亽.° 提交于 2019-11-29 03:52:04
We need to run a few subdomains from our main site and we need to point these to external sites that deal with the admin required. I simply need to redirect a subdomain to an external URL using .htaccess and also any advise about where to put it in the .htaccess file e.g. right at the top, as i know this effects certain rewrite rules. I won't write what i think it should be as this just leads the answer down a specific route. Cheers Guys, Really appreciate it. Dan If you are redirecting a subdomain to another domain then there shouldn't be anything else in the .htaccess file other than this. #

Symfony dynamic subdomains

血红的双手。 提交于 2019-11-29 02:55:16
问题 I'm trying to match subdomains to a customer id in symfony. i.e. i have customer1.example.com and customer2.example.com Domains are stored in a table. When a user goes to customer1.example.com, I would like to get the subdomain, look up the domain name in the database, once matched, it will then deploy the app config for that customer and then store the customer_Id in a global attribute so i know exactly which customer I'm dealing with througout the whole application. The virtual host will

How can I handle subdomains with one laravel installation

流过昼夜 提交于 2019-11-29 02:32:07
问题 I am creating a laravel project for which I need one laravel installation and use its instance in sub-domain with separate database . And those separate database's info will not be in config/database.php. It will get from master database and then reconnected to the other database. I didn't find any proper way to do this. Do you have any idea on this ? Thanks for your time. 回答1: Laravel supports multiple Database connections. Firstly, define the connections in config/database.php : <?php