Archive for April, 2011

Backing up your server using JungleDisk Server Edition – part 3

This is the third part in a three-part series. Make sure to read part 1 and part 2!

The one bad thing I’ve come to notice about the JungleDisk Server Edition is, over time, it tends to hog a lot of memory, even when it’s not running backups. The author at geektank.net noticed this too, and recommended it may not be a good fit for low-memory VPS configurations.

But if JungleDisk is a good fit for your needs, and the memory usage is the only issue, here’s something to try. It’s either a clever solution or an ugly workaround. Call it what you will.

What we’re going to do is create a cron job that will restart jungledisk when it is done running the backup, which will free up any potentially wasted memory.

So, we’ll start by creating a postbackup.sh script to run after your backup job. For advice on how to create and schedule this script, see my previous article, Backing up your server using JungleDisk Server Edition – part 2.

Create your postbackup.sh file with the following line:

touch /etc/jungledisk/.restartjd

Now, create the following jd-check.sh script and make it executable. It should be setuid root.

#!/bin/bash
if [ -e /etc/jungledisk/.restartjd ]
then
rm /etc/jungledisk/.restartjd && /etc/init.d/junglediskserver restart
fi

That’s about as simple as it gets, right there.

The new script should be run on a cron job that will cause it to run often enough to restart jungledisk after a backup. A suggestion would be to have it run about a half-hour to an hour after your backups are scheduled to start.

There are some security implications to where you store your temp file, what your name it, and what permissions you give it, so use your head. If you carefully read part 2, you can get a good handle on how to be mindful of the security issues.

It’s also possible to simply restart junglediskserver on a cron job, but there’s the potential you could restart it when it’s in the middle of a backup. This would cause the backup to either postpone the backup, or resume immediately, and leave stale memory allocations again, which defeats the point. What I’m aiming for here is to have it restart as quickly as possible once the update completes.

Do you have any thoughts on this approach? Know of a way that might work better? Feel free to share your thoughts in the comments below! Thank you.

, , ,

Leave a comment

How to securely wipe hard drives

I often times get asked by friends and clients to refer them to a good tool for securely wiping their hard drives. If you’re decommissioning, selling, or returning a drive with sensitive or confidential data on it, you are right to take measures to wipe the drive.

Deleting files from a hard drive doesn’t actually delete them. Instead, it merely “marks” them as deleted, leaving the original data intact until the disk space is reused. It may be that even after that space is reused that partial remnants of the files still remain, and can be easily recovered. TechRepublic wrote up a good article backed by solid research that shows just how many drives contained easily-recoverable data. The results are unnerving, but they don’t have to be.

When wiping drives is a concern, you have two choices — completely wiping a drive that you’re no longer using — that is, if you’re going to part with it; or wiping only the “free space” of your computers hard drive that you’re still using, simply to make sure deleted files are actually gone and unrecoverable.

There are many good, free, easy-to-use utilities that do an excellent job of wiping your drives. Here’s are two that I’m most familiar with and can recommend:

Darik’s Boot and Nuke (DBAN) – (website) (download) – Wipes drives completely

Darik’s Boot and Nuke (“DBAN”) is a self-contained boot disk that securely wipes the hard disks of most computers. DBAN will automatically and completely delete the contents of any hard disk that it can detect, which makes it an appropriate utility for bulk or emergency data destruction.

Eraser – (website) (download) – Can do “free space”-only wiping

Eraser is an advanced security tool for Windows which allows you to completely remove sensitive data from your hard drive by overwriting it several times with carefully selected patterns. Eraser is currently supported under Windows XP (with Service Pack 3), Windows Server 2003 (with Service Pack 2), Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2.

CCleaner – (website) – Free space and full drive wiping for Windows

Besides being an all-around great cleaner for the registry, CCleaner now includes the ability to wipe both full drives and free space only. A great utility for Windows users.

These are just two programs, and there are many more available.

If you’re a *nix user, Engadget points the way to the shred program. In a nutshell, the following command is what you’re looking for:

shred -vz -n 3 /dev/sda

This will write 3 passes of random data to /dev/sda (make sure that’s the right drive before you start!), followed by a 4th pass of zeros.  It takes some time, so if you don’t mind random (suspiciously random) data on the drive, you can skip the zeroing pass by omitting the z flag.

Do you have a suggestion for a utility that can securely wipe hard drive data? Do you have any questions or feedback on the above? Please voice your thoughts in the comments below! Thank you!

, , ,

Leave a comment

My first thoughts on the Wii 2 (The Wii HD?)

A BBC News article passed to me by my friend NMI contains the first announcement I’ve heard about the Nintendo Wii 2. However, from the limited information in the article, I honestly can’t say for sure whether or not I’m excited by it.

Let’s review:

No technical details about the machine have been revealed, but gamers will get an early preview at the E3 Expo in Los Angeles in June. … However, sales have been gradually declining in the face of tough competition from PlayStation, XBox 360 and mobile gaming platforms. … Wii was the first console of the current generation to offer motion controlled gameplay.

This was (and still is, in my opinion) one of the Wii’s strongest selling points: Motion-based gameplay out-of-the-box. With the Wii, motion control is accomplished with the Wii remote (“Wiimote”) and optionally the nunchuck. With the PlayStation Move and XBox 360 Kinect, the motion-based controls are sold as add-ons to the console, and not all games support them.

Some observers had speculated that the Wii 2 would simply update the existing machine, adding a handful of features such as high definition graphics. … “The talk was about Wii HD, but I do not see Nintendo doing that. It will do something more innovative,” he told BBC News.

The Wii fell short when it was launched with only support for 720px graphics; not the 1080px of the PS3 or the XBox 360. I believe this is something that ultimately hurt Nintendo and helped Microsoft and Sony.

Mr Minkley noted that Nintendo marketed the original Wii around its motion-sensing handset, rather than technical specifications – something he expects to see repeated. … “Nintendo would never launch a console based on the strength of hardware. Theirs has to have a gameplay point to it,” he said.

No kidding. The Wii is considered by many to have the weakest graphics and hardware of its console generation. In fact, the Wii is the only console that doesn’t support any type of native CD/DVD playback. The earlier generation Wiis had the hardware (and homebrew software could take advantage of it), but Nintendo quietly fixed that in the newer white, red, blue, and black Wiis.

A combination of its relatively low price and its appeal to non-traditional gamers – including women and older players – helped the company sell 20m units in the first year.

Nintendo did something really great with the Wii — they didn’t just make it family friendly, they made it player friendly. In most cases, it doesn’t take much to pick up a Wii and start playing — games typically have very intuitive controls and a very gentle learning curve. The uniqueness of the Wii motion controls made it the first gaming console to be adopted for physical therapy use.

So what’s new on the horizon for Nintendo? What do you think, what have you heard, and what would you like to see? Share your thoughts in the comments below.

, , , ,

Leave a comment

kernel atkbd.c: Unknown key released messages on Linux

I just installed Ubuntu 10.10 (Maverick Meerkat) on to a Dell Vostro 1000. (Yea, yea, I know Natty is just around the corner). During the installation I dropped the terminal box down — ‘cus I’m like that — and noticed the following messages spamming the terminal log:

Apr 20 14:17:59 Vostro-1000 kernel: [    2.814838] atkbd serio0: Unknown key pressed (translated set 2, code 0x8d on isa0060/serio0).
Apr 20 14:17:59 Vostro-1000 kernel: [    2.814844] atkbd serio0: Use 'setkeycodes e00d ' to make it known.

Unplugging the laptop’s AC adapter caused it to throw the same event, this time with code e06e.

After some research, it looks like various model laptops throw odd keycodes in response to AC adapter/battery events. The Dell Vostro 1000 seems to be the one that comes up the most in searches, but the Dell Latitude 131L (which is based on the same design / hardware) is mentioned in Launchpad bug #549741, which is specific to this issue. The Inspiron 1501 is mentioned in Redhat bug #454131.

There’s also the issue of the specific keycodes that are thrown. Myself, I saw e00d and e06e. The author at DezzaNet mentions e055 as well.

So how to get rid of these messages?

The two bug reports referenced above mention removing and replacing the battery while the system is on. However, that may not work in all cases. There’s another way to get rid of the messages, and that’s mapping the keycode to the NULL character.

To do this at every bootup, edit the /etc/rc.local file and add lines like the following above the exit 0 statement:

setkeycodes  255

For example:

setkeycodes e00d 255

Repeat for each keycode you will to null out.

Questions, comments, feedback regarding this? Feel free to share in the comments below. Thank you!

, , , ,

Leave a comment

Upgrading your Ubuntu Linux filesystem from Ext3 to Ext4

With recent Linux distributions (based on the 2.6.28 kernel) the Ext4 file system is considered stable and provides many improvements over Ext3.

Ubuntu systems running 9.04 (Jaunty Jackalope) had the option to format Ext4 during install time, but Ext3 was the default until 10.04 (Lucid Lynx). However, it’s possible (and fairly easy) to upgrade Ext3 to Ext4 in-place and without reformatting or reinstalling. Nice, huh?

The following guide is based heavily off the Ubuntu documentation, which some added steps and clarification. If you’re going to do this, use your head and make sure you have backups of your important data before you start, just in case. Also, don’t skip any steps, and double-check yourself along the way. A typo could ruin your day.

Zero – Before you start

Verify your kernel version by running uname -r. Make sure it is 2.6.28 or higher. If it is not, STOP. Upgrade your kernel before attempting to proceed.

Also, check that you’re currently using Ext3 — this would be pointless if you’re already running ext4 — by using the mount command. You should see something like the following:

/dev/sda1 on / type ext3

This shows ext3 as the current filesystem type.

One – Turn off any automatic updating

Go to System > Administration > Update Manager. Click Settings and set Automatic Updates to Only notify about available updates. You want to make sure that the system doesn’t start applying an update halfway through this and give you the potential worst-case of an unbootable system.

Two – Prepare to load the Ext4 driver

Ext4 is backwards compatible with Ext3, which makes this update process as easy as it is. We’ll start by telling the system to load the Ext4 driver instead of the Ext3 driver at boot. This will allow the system to boot and run normally for the steps that follow.

Edit the file /etc/fstab in your favorite text editor. gksu gedit /etc/fstab will do fine. Change any references for disks that you plan to convert from Ext3 to Ext4. Take a look at the example:

# /etc/fstab: static file system information.
#
#                
proc            /proc           proc    defaults        0       0
# /dev/sda1
UUID=327c1819-14e1-4b96-b9d2-d5e55e50f1ae /               ext3    defaults,errors=remount-ro,relatime 0       1
# /dev/sda5
UUID=900e39f2-ad49-42ee-a7f5-8e6807d6b35b none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto     0       0

The above example shows an Ext3 filesystem on /dev/sda1. I’ll use /dev/sda1 as the file system for the rest of the guide for clarity. So, change ext3 to ext4 in the above file and save it.

Reboot. ( shutdown -r now )

Three – Update the filesystem options

After rebooting, the kernel will be using the Ext4 filesystem driver, even though your filesystem on disk is still natively ext3. That’s what you want, you’ll be making the actual changes to the filesystem soon.

Now, run the following command to make the changes to your filesystem that adds the Ext4 features:
sudo tune2fs -O extents,uninit_bg,dir_index /dev/sda1

Note: There’s no spaces after the comma-separated options. Copy/paste if you’re not sure.

This assumes /dev/sda1, like I stated above. Change it if it’s not correct for you, or if you’re doing multiple filesystems, run it for each one.

Reboot again ( shutdown -r now )

Four – Take a deep breath

Due to the changes that tune2fs made on your filesystem, when you reboot you’re going to get the message

“Errors were detected on your filesystem, press ‘F’ to fix…” or something similiar. Press F and let it do it’s thing.

You may get the following error as well (I did):

The disk drive for for /tmp is not ready yet or not present.
Continue to wait or ...

Just wait patiently. You’re waiting for the changes to finish on the currently-processing filesystem, and it’s just telling you that it’s trying to mount or access /tmp and it’s having trouble, due to the currently-running process.

After a few minutes (depending on the size of your partitions and the amount of data on them), everything will go back to normal and you’ll be able to log in again.

There’s just a few more steps.

Five – Reinstall grub

Run the following command to reinstall grub. Note that the partition number is omitted from the device path — this is intentional and correct.

sudo grub-install /dev/sda

You should get a message indicating the operation was successful.

If you are upgrading from 8.04 LTS to 10.04 LTS, you will need to install grub2 as soon as possible, as grub1 is not Ext4-aware. (Users running 9.04 are not affected by this.)

sudo apt-get install grub2

followed by

sudo update-grub

Once it’s done, no more reboots are really necessary, though you can always reboot to make sure grub actually reinstalled correctly. Files written from now on will be written with full Ext4 structures. You can also turn automatic updates back on at this point.

You can verify all the filesystem features are set by running:

sudo tune2fs -l /dev/sda | grep features

This is the list of ext4 features you should have set:
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent sparse_super large_file uninit_bg
If you’re missing one or more features, go back to step three above and check that you entered the command correctly.

Questions, comments, and feedback are welcome, as always.

, , , ,

Leave a comment

iPad used more than Linux computers?

Today, Royal Pingdom posted a somewhat-surprising blog entry that shows that the iPad alone, not any other iOS device like the iPhone or iPod touch, is used more than Linux computers.

Why is this only somewhat surprising? There’s plenty of reasons:

The positive about the Apple devices:

The iPhone and iPod Touch set the stage with — and raised the bar on — user friendliness in portable devices. The iPod was the device that some would argue re-made Apple. It quickly took over the portable media player market and set the new de-facto standard for what to expect in a music player: Lots of storage, and a simple, user-friendly interface. With the iPod Classic, new features brought even higher expectations. The iPod Touch and iPhone sealed the deal for Apple (and some would argue dealt AT&T a blow to the knees).

When the iPad arrived, it ran off the same iOS that the iPod touch did, which brought a familiar look and feel to iOS users. Drawing from the same App Store ensured that users would experience Apple’s touted “There’s an app for that” experience. In addition, the iPad pioneered the tablet experience to the mass market. Behind it’s launch, Android and Blackberry have struggled to gain market share.

The comparison to Linux:

When you compare the Apple iPad to the Linux market, it’s little surprise that the iPad comes ahead. Even the more popular Linux distros like Red Hat and Ubuntu, although moving ahead in leaps and bounds, still suffer their shortcomings with user friendliness and ease-of-use. Hardware quirks and incompatibilities often get the better of inexperienced users, who turn back to Windows or Mac for that lacking bit of hardware support.

Additionally, there aren’t many computer manufacturers who will sell systems with Linux pre-installed for an out-of-the-box experience. While Dell has sold systems with Linux pre-installed, and has sold select system with no OS, there’s a distinct bias in the new-sales model towards Windows. Why? Money. Microsoft pays the OEMs a commission for new-system sales with Windows pre-installed. On top of that, there’s less work for the OEMs to make sure that hardware works as expected. System76 has started picking up the pre-installed Linux market, selling systems with Ubuntu pre-installed, but the price is arguably higher than a system from another vendor, and I can’t speak to the warranty or support.

Conclusion:

Don’t get me wrong, I’m a Linux user and I love it. But I’m not blind to the fact that it has it’s shortcomings — although Red Hat and Ubuntu have really worked towards making everything work as it should, and making the user experience the best possible. Linux also runs on a wider-range (and a more inexpensive range) of hardware than Apple OS. Also, you can’t ignore that this study has a big of a flaw in it: This only compared stats between iPod and mainstream Linux (desktops and laptops) — two completely different device platforms.

Apples to apples or apples to oranges? Do the numbers even mean anything at all? What are your thoughts?

, , , , ,

Leave a comment

Keep your laptop cool the right way

Laptops by their very nature use smaller and more compact systems than their desktop counterparts. Unfortunately, this applies to the cooling system — the heat sink and fan assemblies — as well. Anyone who has any experience with computers, or electronics in general, knows that heat is one of the biggest enemies of electronics.

With the smaller and more compact cooling systems of laptops, unfortunately they have smaller fans and less airflow space, and are more quickly and more frequently affected by dust build-up in the heat sink and fans than desktops. However, even though the air flows through a smaller space, it works very well to cool the laptop, provided that the air spaces aren’t blocked or clogged.

Note that during heavy usage, its normal (and expected) for your laptop to get a little warm on the bottom. However, if you can’t put your hand there without having to pull it away, it’s too hot.

Most laptop users who have experienced an overheating laptop turn to a readily-available but poor choice of solutions: the laptop cooling mat. These poorly-designed devices are generally flat plastic “trays” with a USB-powered fan or two in the middle. They only serve to stir the air under your laptop and actually do very little to cool its hard-working internal electronics.

Signs of an overheating laptop include slow speeds (the processor clocks down to lower it’s heat output after it reaches a certain temperature), random sudden shutdowns (the processor shuts the system down in an “emergency” when clocking down still can’t cool the system), and program freezes, crashes, and more (hot processors become unstable, and the heat can affect nearby components). It’s also not uncommon for sustained periods of high heat to permanently damage your laptop’s motherboard or other components. So, protect your investment and do the right thing: clean it.

Preventing the problem of an overheating laptop is easy to do. Simply blow the air vents out periodically with compressed air. This 2-minute job serves to quickly evacuate the dust and dirt from the heat sink and fans, and keeps the air flowing as it should.

Unfortunately, once the dust has accumulated past a certain point, it’s sure to have formed a giant dust bunny and the compressed air will do very little. It’s simply too large now to go back the way it came in, but it’s still not too late. You’ll have to disassemble your laptop far enough to get the heat sink (and possibly the fan) out and clean it by hand.

Depending on your laptop, it may be a quick operation, or it may not. Use your favorite search engine to find disassembly instructions for your specific model, and budget yourself an hour or so, depending on the length of the procedure.

It’s extremely important that you reapply a thermal compound to the processor before the heatsink is reattached. Thermal compound serves to fill in the small gaps between the processor and the heat sink for ideal heat transfer.

Have a story about an overheating laptop? Have a photo of a giant dust bunny to share? Have some other feedback? Please feel free to share it in the comments below!

Leave a comment

Block access to your website via proxies using .htaccess

If you’re a webmaster, you may want to block access to your site via proxies. While you could do this by blocking the proxy domains individually, there are thousands upon thousands of proxies and more popping up all the time. Rather than block them individually, you can easily block the HTTP headers that [properly behaving] proxies use.

Originally appearing at Perishable Press, the following code segment gets added to your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP:VIA}                 !^$ [OR]
RewriteCond %{HTTP:FORWARDED}           !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA}       !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR}     !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION}    !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION}   !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP}      !^$
RewriteRule ^(.*)$ - [F]

This sends visitors a “403 Forbidden” message. Period.

An interesting update to this finds that most anonymous proxies aren’t sending the headers that this filtering acts upon. You can test this by visiting a site that shows browser HTTP headers, such as HTTP Header Viewer: list browser headers, using a proxy. If you don’t see any of the headers mentioned above, then this code isn’t going to filter for you. Unfortunately the proxies have realized that people aren’t going to use them if they can be easily blocked, and the proxies are getting smarter. That makes blocking them all the more difficult.

If you have a method for blocking proxy access to your site, or anything else to share on this subject, please feel free to share it in the comments below!

Leave a comment

Convert VirtualBox (vdi) hard drive image to VMWare (vmdk) format

I’ve been using VirtualBox for my Windows XP VM when I’m in linux to get a handle on those Windows apps that I absolutely need, and to sometimes address a piece of hardware that otherwise won’t work. One of the biggest issues I’ve had is a distinct lack of VirtualBox to address my BlackBerry — I absolutely must use my Windows hard drive to do it.

VMWare Workstation seems to overcome whatever shortfall exists in VirtualBox to address it, and I’m happy to say, it works quite well. However, now I have this VirtualBox hard drive image with all my software already installed, and I want to boot it in VMWare. How to convert it?

Fortunately, the VBoxManage utility of VirtualBox can actually convert a VirtualBox vdi image to the vmdk format used by VMWare. It can do it rather easily, as well.

The command format is:

VBoxManage clonehd          | 
                            [--format VDI|VMDK|VHD|RAW|]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]
                            [--existing]

Example (Windows):

"c:Program FilesOracleVirtualBoxVBoxManage.exe" clonehd "Win XP.vdi" xp.vmdk  --format vmdk --variant standard

Absolute path to VBoxManage is necessary unless it’s in the Windows $PATH.

Example (Linux):

VBoxManage clonehd "Win XP.vdi" xp.vmdk  --format vmdk --variant standard

Successful run gets this output:

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'vmdk'. UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Next, open VMWare and select Create a new virtual machine

Select “I will install the operating system later”

Make your OS selection about the OS that’s currently on the vmdk you will be using. (The guest OS, not the host OS).

Later on, you will have the option to use an existing vmdk image as your virtual hard drive. Do so.

You should now be able to finish setup and boot your converted disk image.

Note that creating a new machine and using an existing hard drive image is not a feature of VMWare Player. Workstation or another product is required. However, JoVa has shared a great workaround:

Since my tip for VMWare Player is not very clear on what to do exactly, I have the following, easy steps that you can follow, right after you started VMWare Player.
1) Select: Create new Virtual Machine
2) Select Guest Operating OS “Microsoft Windows” and select the version you have (for example “Windows XP Professional”)
3) Click “Next” and give a the virtual machine a name, for example “XP-pro”.
4) Click “Next” set the maximum disk size to the size of your actual virtual machine (important!)
5) Click “Next”and click “Finish”. The VM is created
6) Copy your VM (the .vmdk file) over the created (empty) .vmdk (e.g. xp-pro.vmdk)
7) Play the virtual machine

Questions, comments, or feedback is appreciated, as always.

, , , ,

Leave a comment

Redirect or deny site visitors based on IP using .htaccess

As a webmaster, there may be times when you want to deny one or more IP addresses or ranges from accessing your website. Be it comment spammers, page scrapers, or various other reasons. For that, you’re welcome to adopt the following code snippets. If you’ve found them helpful, or have something to share, please do so in the comments below.

Deny by IP

Start by looking for the following two lines in your .htaccess file

order allow,deny
allow from all

Add the following directives BETWEEN those lines. If you don’t have the above two lines, add them and the following lines between them.

# Throws a "403 Forbidden" for the matching IP ranges
# Matches 91.46.*.*
Deny from 91.46.
# Matches 10.4.5.6 exactly
Deny from 10.4.5.6

Redirect by IP

Copy/paste the following code and add to your .htaccess file, changing the RewriteCond and RewriteRule lines to meet your needs. Read the comments.

# Permanently redirect based on IP rage
<IfModule mod_rewrite.c>
RewriteEngine On
# Try uncommenting this line if it doesn't take
# Options +FollowSymlinks
# The following line describe the IP-pattern to match
# If 1 octet is given, it will match the entire Class-A address
# If 2 octets are given, it will match the Class-B address
# if 3 octets are given, will match the Class-C address
# If 4 octets are given, will match the full address
# The NC directive means Not-Case-Sensitive. It's probably not required.
# Matches 10.1.2.3 exactly
RewriteCond %{REMOTE_HOST} 10.1.2.3 [NC,OR]
# Matches 10.2.*.*
# The trailing period is needed to prevent partial-octet matching
# (i.e. matching 10.200. or 10.20. instead of just 10.2.
RewriteCond %{REMOTE_HOST} 10.2. [NC,OR]
# OR statement must be on all but the last IP to match
# It means, literally, "match this rule, or..."
# Matches 10.5.6.*
RewriteCond %{REMOTE_HOST} 10.5.6. [NC]
# Next line format: RewriteRule <regex to match> <destination> <Flags>
# by default, the next line matches all URLs
# and permanently (301) redirects to the destination.
# Use R=302 instead for a temporary redirect.
# L means this is the last rule to process when this condition is met (recommended)
RewriteRule .* http://example.com/destination.htm [R=301,L]
</IfModule>

Thomas indicates that there should be a trailing backslash-period at the end of the 4th octet, if the octet is less than 3 digits. In testing, I haven’t found it necessary (and it behaves as expected), but readers are encouraged to try it both ways. If you find that one way works over another, feel free to share in the comments.

Here’s a simpler, albeit somewhat less flexible method. This doesn’t use the Apache rewrite module, nor pattern matching, and may or may not fit your needs.

# 301 (permanently) redirect requests for /bar to http://new.example.com/foo/bar
301 redirect /bar http://new.example.com/foo/bar
# Also redirect the web root
301 redirect / http://new.example.com

Questions, comments, and feedback regarding these methods are welcome and apreciated. Have something to contribute, or have feedback about the above code? Please feel free to share in the comments below!

, ,

Leave a comment