Redirect non www to www or vice versa (main domain, subdomain)

There is a project that requires me to make the following domain redirection:

  • Redirect all users to access the site WITHOUT the 'www.' prefix for all subdomain.
  • Redirect all users to access the site WITH the 'www.' prefix for main domain only.

To fulfill this purpose, I simply add a few lines of code to the htaccess file:

RewriteEngine on

# Redirect the 'www.' version of the subdomains.
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.example\.com [NC]
RewriteRule ^(.*)$ http://%1.example.com/$1 [R=301,L]

# Redirect the non 'www.' version of the main domain.
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

For general use, the following is the code to redirect visitors from non www to www or vice versa.

Redirect all users to access the site WITH the 'www.' prefix:

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Redirect all users to access the site WITHOUT the 'www.' prefix:

RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

Working remotely, it is likely you will be considered as?

Working from home is great fun (telecommute), but there are some consequences to be ready you receive, especially if you live in a place where working remotely is not a common things and the money earned above average. It is likely you will be considered as:

  • Using black magic that you just simply stay at home and the money will come by itself.
  • Dealing with terrorists and you as the supplier of its.
  • You run a business that is prohibited by law.
  • You get a very much inheritance from your parents so you just sit and enjoy it all.

For several years now I work remotely and have had some experience as above.