1052Redirecting with meta & refresh

A basic redirect from one website to another:

<meta http-equiv="refresh" content="0; URL=https://www.trembl.org" />
  • content is the dealy in milliseconds
  • URL is the target url

918Permanent Redirect of all Subpages to new Server

LetsEncrypt will not autor-renew if it encounters a 301 Redirect. Which is NG, because it means httpswill stop working.
Not-so-elegant solution: use Redirecting with meta & refresh.

301 Redirect is great, if you want to keep you old structure and only change the server.

.htaccess

Redirect 301 / https://www.trembl.org/

Any page of your old.site/about would get redirected to https://www.trembl.org/about.

If you want to redirect all your page links from your old.site (e.g. old.site, old.site/aaa, old.site/bbb, ...) to https://www.trembl.org, use this RewriteRule:<

.htaccess

RewriteEngine On
RewriteRule ^(.*)$ https://www.trembl.org/ [R=301]

Meaning of 301 and 302

  • 301 Moved Permanently
  • 302 Moved Temporarily

791Combining stderr and stdout 2>&1

If you ever find yourself in a situation of having to call a perl script from within PHP, and you want to get the return values from the perl script, you might do it like the following:

$command = "perl /my/perl/script.pl";
$results = exec($command);
// does not print error

If the perl script generates error, you won't be able to see them, as they are written to stderr.

One solution might be to append the stderr to stdout, therefore getting it into the $results variable.

$command = "perl /my/perl/script.pl 2>&1";
$results = exec($command);
// Prints: Died at /my/perl/script.pl line 25.

As this post explains, 1 means stdout, 2 means stderr. 2>1 might look ok at first sight, but the '1' will be interpreted as a filename. Therefore it has to be escaped with &1, resulting in 2>&1.