If, like me, you often set your servers up to allow traffic to your sites from both domain.com and
www.domain.com but would rather users only used one, there is a simple way to achieve this with Apache and mod-rewrite.
Putting the following in a file called .htaccess within the root of your website, you can achieve this automatic redirection to www. with little effort and no need for code to perform the check.
.htaccess
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^(www.|$) [NC]
RewriteRule ^ http:
{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This code, checks the current HTTP_HOST the user is viewing, so if they were to come via domain.com for an example, it would check to see if the host starts www., this case it doesn't so it would do a 301 redirect to the same URL, but corrected to include www.
Nice and simple, but very useful.
Google have just announced a new service, a public (open) DNS system that they will run and anyone can use. The announcement and launch of this system can be read on their blog
http://googleblog.blogspot.com/2009/12/introducing-google-public-dns.htmlDNS is like a phone book for the internet, converting the nice memorable names that you type, into IP addresses (internet phone numbers). Google's system promises to speed up the process of requesting and resolving the DNS lookups which has the effect of speeding up the users internet experience.
The service is easy to setup, just like OpenDNS (another open DNS system).
Proving a service like this is all well and good, but we all know you don't provide a service for nothing without some motivation behind it. What Google aren't saying is what they plan to do with the data they are collecting on usage patterns, requests made and who is making requests. The more people that do use this system, the more data they can mine about the internet without having to do anything themselves. Using their DNS servers, rather than anyone elses allows them to track EVERY request you make to the internet.
Another thing they can do, is for queries that fail is provide a search or alternative domain, while this may seem useful internet service providers have tried it in the past and users have moaned about the 'hijacking' of their requests rather than being presented with a nice "domain not found" error.
Do you feel Google are trying to take over the internet, one bit at a time or are you happy that they keep providing services for just about everything?
Personally, I think I'll be avoiding it, Google can track enough about what I do already without me giving them anymore.
When making a site live, its useful to be able to update it easily from Subversion systems, i.e. checking out straight into a web accessible area (your public_html for example).
However, doing so could potentially be dangerous dependent on you Apache (IIS, Lighty etc) setup. For example, you could go to a publically accessible folder and then find the subversion dot files .svn/entries as an example.
To protect against this, it is wise to block Apache from allowing users to see these files, they have no need to see them at all so blanket blocking them on your server is definitely worth while.
Adding the following little block to your apache.conf (or httpd.conf) will block users being able to see any .svn folder and files within it, protecting possible sensitive data escaping.
httpd.conf
<Directory ~ ".*.svn">
Order allow,deny
Deny from all
Satisfy All
</Directory>