While installing few php scripts on my local MacOS Monterey I started getting ERR_EMPTY_RESPONSE error in Chrome browser.
First I encountered this issue while installing Typo3 CMS. I tried installing phpMyAdmin and got the same error.
Digging down further and after some tweaking with apache config files and php.ini files I found out that the problem is with Google Chrome and not with MacOS in particular. There may have been some Apache and/or php.ini config settings which fixed this error in other browsers but I’m not sure what is the exact fix.
The Solution
I’m not sure what exactly caused this problem but other folks have been saying it’s cache.
Try cleaning Google Chrome cache.
Restart Mac.
Try in other browsers.
Digging down further it seems that there is something wrong with configuration file.
Checking the apache access log file shows following error
Since the men in tower dictated that SSL will become norm for websites we common men are forced to follow their dogma and do as they dictate us to do.
Not too far in the future, non ssl domains may be blocked by the men in tower all together. So it’s better you start having SSL on your website and redirect http and www to https.
Redirect http & www to https on Linux and Apache
Copy following code towards the top of .htaccess file in your web root and all job will be taken care of.
RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www. [NC] RewriteCond %{HTTP_HOST} ^(?:www.)?(.+)$ [NC] RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Why to redirect www to https?
It’s simply because you don’t want users to type r extra letters to reach your website. https://yourdomain.com is the best url you can have unless you have subdomains in which case www may become a necessity.
Test
Type http://yourdomain.com and http://www.yourdomain.com in browser one by one and it should redirect to https://yourdomain.com.
Don’t forget to replace yourdomain.com with your actual domain 😉
How to add redirect on a self hosted WordPress blog?
Firstly you should fix the url of your blog. From WordPress Dashboard go to Settings -> General
Enter your url with https:// in it. This will be your target and default URL.
Next is to redirect www and http to https. If this is a brand new WordPress installation then you can simply copy and paste above code in .htaccess towards the top.
Here is what a typical .htaccess file will look like after adding redirect code in it. I’ve highlighted redirect code in bold.
Don’t forget to test your blog urls after updating .htaccess code.
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
#### Redirect www, http to https ##########RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteCond %{HTTP_HOST} ^(?:www.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
######################
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php74” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
If your WordPress blog is not fresh then there are chances that some of the plugins may have been already taking care of the redirect. To check it type http, www urls and if it is already redirecting to https then it’s all good. If not then you can copy and paste code as described above.