The easiest way to redirect all your traffic from a WWW address (like www.domain.com) to a non-WWW (like domain.com) is using the following code:

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

With this code, you don’t need to hard-code the name of the domain into the .htaccess file.

Apart from the fact that www is deprecated (more here), the main benefit of doing this (or redirect from non-WWW to WWW) is that Google and other search engines won’t penalize our site because of duplicated content on both versions of our domain (WWW and non-WWW).

Tags: , ,

In Linux (and also in the World of Windows), there is a small great tool called wget (you probably already know it, it’s pretty popular). I have been using it for some years know as it is very convenient for downloading files (or even entire HTML websites) from the command line (specially when you manage a Linux server through SSH). What I didn’t know about it was that it also allows you to recursively copy files from a FTP server (a task that is not usually pleasant).

This is how:

wget -r ftp://username:password@ftp.server.com/*

If the FTP username is something like this: user@somedomain.com, then, you should replace the @ by a + simbol, like this: user+somedomain.com.

Tags: ,

Some time ago I wrote a post regarding this same topic (installing an updated version of Nginx instead of the one that is on the official Ubuntu repositories) but for Hardy (8.04).

Now, it is the turn of the latest Long-Term-Support version of this Linux distribution.

In this case, we need to use this repository:

deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main

You can create a file like /etc/apt/sources.list.d/nginx-stable.list, and put that line inside.

We also need to add the key of this repository so Ubuntu won’t complain.

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 00A6F0A3C300EE8C

and finally, run:

apt-get upgrade && apt-get install nginx

Tags: , , , ,

  • Facebook
  • Google+
  • LinkedIn
  • Twitter
  • Flickr