Virtual Solutions : Main : Blog :
Home
Recent Articles
January 28th, 2010 by Dan
Here is a quick and easy solution to those who want to force all URLs to lead with www. For example, rewrite http://yourdomain.com as http://www.yourdomain.com. There are those that argue that is it is more SEO optimized to do this. To do this, add the following to your top (root) .htaccess file (or create one if it does not exist already):
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
$1: RewriteRule backreference – requested directory/file passed to rewritten URL
R=301: Permanent Redirect – 301 redirect is the most efficient and SEO Friendly method for redirection.
L: Stop the rewriting process here and don’t apply any more rewriting rules.
Posted in Apache | No Comments »
June 21st, 2009 by Dan
Got a lot of valuables (cash, jewelery, etc.) you need to store safely in your home? Then, a home safe may be the answer. But, they can run into the hundreds of dollars for a good one. Here’s a cheaper solution. Go to a swap meet, and pick up a VCR. You should be able to get one for less than $10. Doesn’t matter if it works or not. Take it home, place it by your TV, and hook it up. Again, doesn’t really have to work (only have the appearance that it is part of your entertainment system), so you don’t have to be exact with the connections. Bingo, you now have a home safe (invaluable) to store your valuables. Just open the tape door, insert trinkets, and close door. No self-respecting or self-loathing thief would ever consider stealing a VCR. And, can you imagine a burglar lugging around a VCR, with the best hope of selling it for lunch money. To that end, try to get the oldest and heaviest VCR (which should be next to nothing). Even better, BetaMax machine. DVD machines next on list in near future, but more suitable for cash.
Next week’s tip: Turning Your CRT TV into an Aquarium
Posted in Uncategorized | No Comments »
June 13th, 2009 by Dan
All of a sudden, my mouse (Microsoft Wireless Laser Mouse 8000) started double-clicking when the left mouse button was clicked once. Can you imagine the frustration. This issue began after the last Windows (Vista) update. What a coinky-dink! So, I go to the Microsoft website to download and install a new driver for the mouse. Everything goes fine. So I thought. Still double-clicking. Now, I start looking online for a new mouse to go out to purchase. I don’t have this time for this nonsense. Then I tried something. I noticed that my mouse pad was starting to look a little fuzzy. I replaced the mouse pad with another (new, non-fuzzy one) from another computer here (one that does not use a wireless mouse). I also flipped the mouse over to expose the underneath side. I blew out the optical sensor hole, flipped over the mouse, and gently tapped the mouse on the desktop. Fingers crossed (which can make it hard to operate a mouse), I tried again. No double-clicking. It would seem that hair, fibres from the mouse pad, etc., got lodged in the region near the optical sensor. And, the mouse interpreted the “debris” as movement. Sometimes a coincidence is just that, a coincidence. And here I was ready to hang Bill Gates in effigy =)
Posted in Computer Hardware | No Comments »
May 2nd, 2009 by Dan
What is hotlinking? Hotlinking is directly embedding or linking to a file on another server/website, so it appears to be originating from the linking website. For example, images or videos. This is violation of netiquette, and can be litigated. Here is a solution. If it does not already exist, create a file called .htaccess, and upload to your server. Then, add some Rewrite code to the .htaccess file to deny access on the basis of referer. For example:
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
A good tool to generate the file can be found here: http://www.htaccesstools.com/hotlink-protection/
If you want to redirect surfers who originate from a given referer, then add this to your .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http(s)?://(www\.)?anotherdomain.com [NC]
RewriteRule /* http://www.somedomain.com/ [L,R]
This will redirect people who follow a link to your site on anotherdomain.com to somedomain.com
Note that referer checking is far from perfect. Referer can be spoofed. Often, referer is not passed by the browser. For example, many firewalls etc. have privacy set by default to not pass referer. And, referer may not be passed if referring link opens your site in a new window, or opens using JavaScript.
Note that if you get a server error 500 after you upload the .htaccess file, delete the Rewrite lines except the RewriteEngine On line. If you still get the same error, then you do not have mod_rewrite compiled into Apache. Delete that line, and contact your web host to request that they install mod_rewrite (and restart the web server). However, if no error, then typo in one of the Rewrite lines – your server error log (for example, via cPanel) should provide a clue. If you do not have access to error log or you cannot resolve the error, try asking your web host (in the meantime, comment out the Rewrite lines by adding # to beginning of each Rewrite line).
Posted in Apache | No Comments »
April 24th, 2009 by Dan
Yet another tip that I use from time to time which I feel may be of benefit of others. It allows you to estimate file space used in a given directory by executing the ‘du‘ command via SSH (Secure Shell) / Telnet. For example, to display usage of ‘content’ directory (that contains two subdirectories: 1subdirectory and 2subdirectory) in human readable format (Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte):
du -sh *
Example output would be:
25.3M 1subdirectory
1.35G 2subdirectory
Refer to the du man page for further details regarding the ‘du‘ command: du command
Posted in UNIX | No Comments »
© Copyright 1997 - 2010 Virtual Solutions. All Rights Reserved.
Virtual Solutions Blog is proudly powered by
WordPress
Page took 15 queries. 0.621 seconds
|
|
|
|