subdomain

regular expression for validating url with sub-domain

孤人 提交于 2020-01-06 14:55:16
问题 preg_match('/^(http:\\/\/)?(.+)\.MYDOMAIN\.com(.*)/', $url, $match) This is my regex to validate a URL that must have a sub-domain, but if someone uses www instead of sub-domain it also gets validated. For example: http://shoes.en.MYDOMAIN.com/ This must pass http://www.MYDOMAIN.com/ This must fail How can I edit my regex to fail if the sub-domain is www ? 回答1: I think you can do it with a negative lookahead assertion: (?!www\.) which being placed after the protocol check, checks if there is

PHP Subdomain session disappearing

馋奶兔 提交于 2020-01-06 14:45:39
问题 index.php session_start(); if(!isset($_GET['n'])) { $_SESSION['foo'] = "bar"; header("Location: /index.php?n=D"); } echo "FOO: ".$_SESSION['foo']; This page index.php is used in a subdomain. The subdomain is a folder in the root domain, i.e. - WWW - SUB DOMAIN - index.php The session variable foo is set on page call, then checked after a redirect header - and it's gone. I've tried: ini_set('session.cookie_domain','.example.com'); Various combinations of session_set_cookie_params() Location:

Advice on Configuring .HTaccess file to Redirect HTTP Subdomain to HTTPS Equivalent

我的梦境 提交于 2020-01-06 05:59:50
问题 I'm sure there is an easy answer to this question, but I've scoured through through available threads and its either not there or I'm too ignorant to recognize it starting in my face. This seems to be the answer, but I just can't configure correctly. Question : How do I set up .htaccess so that all subdomains are forwarded to their https equivalents, while also allowing the main domain itself get ported to its https equivalent? In other words: hxxp://subdomain1.domain.com --> hxxps:/

Second Level Subdomains in Azure Apps

谁都会走 提交于 2020-01-06 02:13:09
问题 I've looked everywhere and can't find what I exactly want. A second-level subdomain in azure itself and not in a custom domain name. I've done that with my other domain using cname and a records. I need to do something like ABC.XYZ.cloudapp.net Every article I read presumes I have a custom domain, I still didn't buy one for this roject. My current project is for a wordpress multisite so want to do something like portfolio.myapp.cloudapp.net Any ideas? 回答1: This is not possible at the moment.

Can I make Rails / WEBrick recognize entries in /etc/hosts as subdomains (instead of domains)?

筅森魡賤 提交于 2020-01-05 18:30:09
问题 I'm trying to use subdomains locally for a Rails app so I added the following line to my /etc/hosts file: # add 'test' subdomain for localhost 127.0.0.1 test.localhost Now I can point my browser to test.localhost:3000 and it hits my Rails app. However, Rails or WEBrick interprets the whole darn thang as the domain: # logging in the controller logger.debug("domain: '#{request.domain}', subdomain: '#{request.subdomain}'") # output in the console domain: 'test.localhost', subdomain: '' Is there

how to exclude one subdomain from subdomains that share SESSION variable

半世苍凉 提交于 2020-01-05 15:05:07
问题 I had a cookie-free subdomain (static) until I used this code to make my session variable visible in all sub-domains: session_set_cookie_params(0,'/','.example.com'); apparently, By doing so, I have lost cookie-free characteristic of the "static" subdomain. How could I have one session variable visible in all subdomains except the static one? thank you for helping 回答1: I was having similar problem as you, and I think my solution will help you for your cookie-less static domain. I've described

How to write a htaccess file to wildcard folder to subdomain

半腔热情 提交于 2020-01-05 07:42:30
问题 I'm trying to redirect all my folders (using a wildcard) to their subdomain. For example: www.mywebsite.com/folder1 to folder1.mywebsite.com/ www.mywebsite.com/folder2 to folder2.mywebsite.com/ www.mywebsite.com/folder3 to folder3.mywebsite.com/ Now without writing a rule for each one of them, is there a way to redirect them all to their respective subdomain? I tried: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com$ RewriteCond %{HTTP_HOST} ^(\w+)\.mywebsite\.com$ RewriteRule

How to write a htaccess file to wildcard folder to subdomain

半世苍凉 提交于 2020-01-05 07:42:26
问题 I'm trying to redirect all my folders (using a wildcard) to their subdomain. For example: www.mywebsite.com/folder1 to folder1.mywebsite.com/ www.mywebsite.com/folder2 to folder2.mywebsite.com/ www.mywebsite.com/folder3 to folder3.mywebsite.com/ Now without writing a rule for each one of them, is there a way to redirect them all to their respective subdomain? I tried: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.mywebsite\.com$ RewriteCond %{HTTP_HOST} ^(\w+)\.mywebsite\.com$ RewriteRule

PHP regex to match alphanumeric and hyphens (not spaces) for use as subdomain

心不动则不痛 提交于 2020-01-04 16:56:10
问题 I have the following regex, which I interpret as a pattern that will match a string consisting of just alphanumeric characters and hyphens. if (preg_match('/[A-Za-z0-9-]/', $subdomain) === false) { // valid subdomain } The problem is this regex is also matching blank spaces, which is obviously undesirable in a subdomain name. For bonus points, is this a suitable way to validate subdomain names? I'm unsure which special characters are allowed but thought I would keep it simple by only allowing

GWT - “Access is Denied” JavaScript error when setting document.domain in Internet Explorer only

自闭症网瘾萝莉.ら 提交于 2020-01-03 14:16:13
问题 Background Information I am working on a web application that utilizes GWT (v2.4). For the application, I am creating an iframe that will display some information from another website. I need to access some information from that iframe that is normally restricted via the Same Origin Policy (SOP). However, both sites (the parent and iframe) are hosted on the same super-domain, just under different sub-domains. So, something like this: Parent: dev.app.mySite.com frame: someOtherContent.mySite