PHP get domain name [duplicate]

Similar question has been asked in stackoverflow before. See here: PHP $_SERVER[‘HTTP_HOST’] vs. $_SERVER[‘SERVER_NAME’], am I understanding the man pages correctly? Also see this article: http://shiflett.org/blog/2006/mar/server-name-versus-http-host Recommended using HTTP_HOST, and falling back on SERVER_NAME only if HTTP_HOST was not set. He said that SERVER_NAME could be unreliable on the server for a variety of reasons, … Read more

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

It doesn’t matter which you choose but you should pick one and be consistent. It is more a matter of style but it is important to note that search engines consider these two URLs to be different sites: http://www.example.com http://example.com So whichever you choose for aesthetic reasons should be consistently used for SEO reasons. Edit: … Read more

What is a regular expression which will match a valid domain name without a subdomain?

I know that this is a bit of an old post, but all of the regular expressions here are missing one very important component: the support for IDN domain names. IDN domain names start with xn--. They enable extended UTF-8 characters in domain names. For example, did you know “♡.com” is a valid domain name? … Read more

Linux command to translate domain name to IP [closed]

Use this $ dig +short stackoverflow.com 69.59.196.211 or this $ host stackoverflow.com stackoverflow.com has address 69.59.196.211 stackoverflow.com mail is handled by 30 alt2.aspmx.l.google.com. stackoverflow.com mail is handled by 40 aspmx2.googlemail.com. stackoverflow.com mail is handled by 50 aspmx3.googlemail.com. stackoverflow.com mail is handled by 10 aspmx.l.google.com. stackoverflow.com mail is handled by 20 alt1.aspmx.l.google.com.

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

If you have directory indexing off, and is having this problem, it’s probably because the try_files you are using has a directory option: location / { try_files $uri $uri/ /index.html index.php; } ^ that is the issue Remove it and it should work: location / { try_files $uri /index.html index.php; } Why this happens TL;DR: … Read more

tech