28 March, 2022 seen 66
Not the biggest Apache fan here, but today working on a server while setting up Apache as a reverse proxy for the JBoss…
It has been years since I last time used .htaccess file available in Apache. I'm using Ngnix servers for 99.9 of mine work.
But today I had an opportunity to work on Apache environment, which uses .htaccess file.
So in order to rewrite non www to www in Apache I added following rulles to .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
For Ngnix please read this article: