domain-name

Get The Current Domain Name With Javascript (Not the path, etc.)

蹲街弑〆低调 提交于 2019-11-27 09:07:26
问题 I plan on buying two domain names for the same site. Depending on which domain is used I plan on providing slightly different data on the page. Is there a way for me to detect the actual domain name that the page is loading from so that I know what to change my content to? I've looked around for stuff like this but most of it doesn't work the way I want it to. For instance when using document.write(document.location) on JSFiddle it returns http://fiddle.jshell.net/_display/ i.e. the actual

What's the best method in ASP.NET to obtain the current domain?

陌路散爱 提交于 2019-11-27 06:04:24
I am wondering what the best way to obtain the current domain is in ASP.NET? For instance: http://www.domainname.com/subdir/ should yield http://www.domainname.com http://www.sub.domainname.com/subdir/ should yield http://sub.domainname.com As a guide, I should be able to add a url like "/Folder/Content/filename.html" (say as generated by Url.RouteUrl() in ASP.NET MVC) straight onto the URL and it should work. Same answer as MattMitchell's but with some modification. This checks for the default port instead. Edit: Updated syntax and using Request.Url.Authority as suggested $"{Request.Url

Are email addresses allowed to contain non-alphanumeric characters?

痴心易碎 提交于 2019-11-27 03:47:21
I'm building a website using Django. The website could have a significant number of users from non-English speaking countries. I just want to know if there are any technical restrictions on what types of characters an email address could contain. Are email addresses only allowed to contain English letters, numbers, _ , @ and . ? Are they allowed to contain non-English alphabets like é or ü ? Are they allowed to contain Chinese or Japanese or other Unicode characters? Email address consists of two parts local before @ and domain that goes after. Rules to these parts are different: For local

Check for a valid domain name in a string?

别等时光非礼了梦想. 提交于 2019-11-27 03:31:11
问题 I am using python and would like a simple api or regex to check for a domain name's validity. By validity I am the syntactical validity and not whether the domain name actually exists on the Internet or not. 回答1: Any domain name is (syntactically) valid if it's a dot-separated list of identifiers, each no longer than 63 characters, and made up of letters, digits and dashes (no underscores). So: r'[a-zA-Z\d-]{,63}(\.[a-zA-Z\d-]{,63})*' would be a start. Of course, these days some non-Ascii

WWW or not WWW, what to choose as primary site name? [closed]

佐手、 提交于 2019-11-26 23:56:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . From technical perspective the only issue is traffic and incoming links (one of them should redirect to another). Now I need to choose which one should be primary. Some sites have www (google, microsoft, ruby-lang) and some without www (stackoverflow, github). Seems to me the newer do not use WWW. What to choose

Get domain name (not subdomain) in php

…衆ロ難τιáo~ 提交于 2019-11-26 18:53:45
I have a URL which can be any of the following formats: http://example.com https://example.com http://example.com/foo http://example.com/foo/bar www.example.com example.com foo.example.com www.foo.example.com foo.bar.example.com http://foo.bar.example.com/foo/bar example.net/foo/bar Essentially, I need to be able to match any normal URL. How can I extract example.com (or .net, whatever the tld happens to be. I need this to work with any TLD.) from all of these via a single regex? Well you can use parse_url to get the host: $info = parse_url($url); $host = $info['host']; Then, you can do some

Nginx 403 error: directory index of [folder] is forbidden

て烟熏妆下的殇ゞ 提交于 2019-11-26 14:58:41
I have 3 domain names and am trying to host all 3 sites on one server (a Digital Ocean droplet) using Nginx. mysite1.name mysite2.name mysite3.name Only 1 of them works. The other two result in 403 errors (in the same way). In my nginx error log, I see: [error] 13108#0: *1 directory index of "/usr/share/nginx/mysite2.name/live/" is forbidden . My sites-enabled config is: server { server_name www.mysite2.name; return 301 $scheme://mysite2.name$request_uri; } server { server_name mysite2.name; root /usr/share/nginx/mysite2.name/live/; index index.html index.htm index.php; location / { try_files

How to validate domain name in PHP?

不想你离开。 提交于 2019-11-26 12:18:43
Is it possible without using regular expression? For example, I want to check that a string is a valid domain: domain-name abcd example Are valid domains. These are invalid of course: domaia@name ab$%cd And so on. So basically it should start with an alphanumeric character, then there may be more alnum characters plus also a hyphen. And it must end with an alnum character, too. If it's not possible, could you suggest me a regexp pattern to do this? EDIT: Why doesn't this work? Am I using preg_match incorrectly? $domain = '@djkal'; $regexp = '/^[a-zA-Z0-9][a-zA-Z0-9\-\_]+[a-zA-Z0-9]$/'; if

What's the best method in ASP.NET to obtain the current domain?

邮差的信 提交于 2019-11-26 11:52:02
问题 I am wondering what the best way to obtain the current domain is in ASP.NET? For instance: http://www.domainname.com/subdir/ should yield http://www.domainname.com http://www.sub.domainname.com/subdir/ should yield http://sub.domainname.com As a guide, I should be able to add a url like \"/Folder/Content/filename.html\" (say as generated by Url.RouteUrl() in ASP.NET MVC) straight onto the URL and it should work. 回答1: Same answer as MattMitchell's but with some modification. This checks for

Are email addresses allowed to contain non-alphanumeric characters?

喜你入骨 提交于 2019-11-26 10:56:52
问题 I\'m building a website using Django. The website could have a significant number of users from non-English speaking countries. I just want to know if there are any technical restrictions on what types of characters an email address could contain. Are email addresses only allowed to contain English letters, numbers, _ , @ and . ? Are they allowed to contain non-English alphabets like é or ü ? Are they allowed to contain Chinese or Japanese or other Unicode characters? 回答1: Email address