Slidex
Website Design Promo

301 Redirection in Apache using htaccess file

January 28th, 2008 admin Location: Raleigh, North Carolina

Last time I checked I had a difficult time finding easy-to-digest information about the 301 canonical redirection. Why does it has to sound so complicated? Anyways, I am going to explain here each of the components of an effective htaccess 301 canonical redirection. If you are one of those people that like the complicated stuff and the higher level explanations, this post is not for you.

OK, let’s start by taking a look at the entire snippet of the canonical redirection. But before we proceed, please remember two things, one is that the .htaccess is a file that can be included in any folder under your domain and therefore from this point on we will be referring to the one located in your root directory (the same as the home page). The second thing to remember is that the htaccess won’t be available in the front side of your site (the client side), therefore either you will have to log in to your Control Panel (Cpanel for example) or you may need an ftp access to your server (which is my preferred method).

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

The first line:

“RewriteEngine on” means that if for whatever reason the engine is turned off, we would avoid several headaches trying to find what is wrong with the code. This part isn’t essential since most of the time the engine is already on.

The second line:

The Rewrite Condition. Basically refers to a set of criteria that has to be met in order to apply  the rewriting. It is composed of two parts, first the parameter and second the value. So for example in this case, the rule’s parameter is the Host requested. The value here (^yoursite.com) as you can see has a “^” sign in front of it. This sign means “at the beginning” in regular expressions. Which would mean that the Host requested needs to have yoursite.com at the beginning, otherwise don’t apply the rule. In what cases this would be the case? For example if you had subdomains configured such as: lorem.yoursite.com or lipsum.yoursite.com. Both of this subdomains wouldn’t receive the rule because the Host requested starts with something different than just yoursite.com. The final part of the second line is the [NC] directive. This directive means “no case”, so regardless of if the request was with capital letters or lower cases, still the rule would apply. For example if the request was for YOURDOMAIN.com and another one for YourDomain.com, both of them would receive the application of the rule.

The third and final line is the fun one. Up to this point nothing has been performed yet. The third line contains the rule to be applied or the “transformer”. It is composed of three sections divided by a space. The first section is the matching. What should be match from the request? In this case ^(.*)$ means: ^ (the beginning as before), then (.*) means: match (.) any character and as many times as necessary (*); finally the $ means the end of the string. So for example, if we wanted to match the first two letters of a the word “Monopoly” we could create a match by using: (..) which would return Mo.

The second section of the third line is the application of the rule. So once we matched a specific part of the request, now what? The second part is the “do what section”. So in this case, rewrite the url as: http://www.yousite.com/$1. You might be wondering: Why $1 at the end? Well the parenthesis in the first part of the third line are containing the complete request ((.*)), so we can reference that matching by using $1. And if you had several parentesis in the matching, such as (.*)ts(.*),  you could reference the first one as $1 and the second one as $2 and so forth with as many as needed.

The final portion is the modifiers. The modifiers in this case determine the kind of redirection that is taking place. The L means that if the pattern was matched then it should be considered the “last line”. And the R=301 means that the redirection should be treated as an external redirection with header code 301 (which means permanently moved to).

I hope this helps us get a better understanding of the basics of canonical redirection.

Alex Centeno MBA.

The trend is A/B testing

January 22nd, 2008 admin Location: Raleigh, North Carolina

So the trend this days in internet marketing is to do some A/B testing and find how to optimize your content to better serve your audience and therefore gain conversion power. Here is a video from Tom Leung from the Conversion University at Google. I guess the most important part is to understand that only by implementing changes you will improve. Don’t just test and learn. Once you know what can be optimized, go ahead and do the work and move on.

Since I love SEO, optimizing based on data is one of my favorite things in life. Perhaps for you it isn’t. It takes a lot of time, a lot of attention and a great amount of hours in front of your LCD. The good part about it is that at the end, you will feel like you have accomplished something.

Remember too that A/B testing, if not done properly, can have a negative effect in your search engine visibility. More on that topic in the posts to come.

Take a look at the video and start testing in this 2008! Happy testing!

[youtube]http://www.youtube.com/watch?v=GZlGy2auvFo[/youtube]

Finally, take a look at this excellent post about the implementation of Google Analytics through a home-made API. This post makes me really happy.

Iphone, How to activate (not unlock) 1.1.2 with Bootloader 4.6

January 11th, 2008 admin Location: Raleigh, North Carolina

 This is more a post for myself than for anybody else. But I though, oh well, perhaps somebody else would benefit from this fast tutorial as well. First I want to say that there is a lot (HUGE AMOUNT) of noise on the web. There is people saying that you can unlock the iPhone, others saying that you can’t activate the OTB(out of the box) version and others saying that you could render your iPhone inoperable. This post is just a fast look into the way I did it after researching for more than 2 weeks. Good Luck.

NOTE: Activate, Open and Unlock. Once you buy a new iPhone, the first thing that you will see is that you can’t use it unless you activate it. This process of making the new Iphone work is called activation. Once the activation is completed, you can prepare it so that you can install and run native applications on it. This process we are going to call opening. Finally, if you need to make your phone work with any other carrier than AT&T, then this is called unlocking.

In this small tutorial I am just going to cover the first two: Activation and Opening for the OTB 1.1.2 and Bootloader 4.6 iPhone. I believe that without an external SIM card modifier, this kind of phone is not yet( Jan 08) unlocked.

Process.

1. Download the iPhone 1.1.1 firmware from a reputable source (there are many out there that have it).

2. Connect your iPhone to your Mac, hit cancel in the main activation window in iTunes and run iNdependence to send your phone to version 1.1.1.

3. Once you see the main dialing window in your iPhone do the following:

3.1. Dial *#307# then press Call.

3.2. The iPhone will ring, press the X button at the top to delete all the characters you just entered (while the iPhone is still ringing). Now enter: 0 then press Call again. Press Answer.

3.3. Press Hold once. Press Decline once

3.4. Press the Contacts button at the bottom of your iPhone screen.

3.5. Add a new contact with any name that contains two URLs as part of its contact information. The first URL is going to be “prefs://” the second URL is going to be “http:// jailbreakme.com” (both without the quotes). Save

3.6. Visit the contact information and click on the prefs URL. Set your WIFI connection.

3.7. Set your Auto-Lock property to NEVER.

3.8. Visit jailbreakme.com and follow the last link to “install apps”.

4. If you need to go back to your preferences window: once back into the dialpad window, press 0 then dial, press answer, press hold, press decline.

5. Now your iPhone should be activated and jailbroken with 1.1.1 firmware.

6. To upgrade it to 1.1.2. Go to Installer.

7. Navigate to Tweaks 1.1.1

8. Install OktoPrep.

9. Launch iTunes and update your iPhone to 1.1.2 by clicking the update button (NOT THE RESTORE).

10. Close iTunes after the process is finished.

11. Download the 1.1.2 jailbreak program. (available at many places). It should be a .jar file. Run the program.

12. Restart the iPhone by pressing the Home Key and the Off key simultaneously for 4 seconds.

13. You are now jailbroken and activated on 1.1.2 and 4.6 Bootloader and you are using AT&T as your carrier.

*This post contains only my personal opinion and it is for educational purposes only.

First SEO Video. SEO Basics Series. Canonicalization

January 9th, 2008 admin Location: Raleigh, North Carolina

seo-first.swf
Canonicalization (Man it is hard to say that), is the practice of choosing one version of several duplicate pages and redirecting the other pages to the chosen one. In this video, Alex Centeno explains the process. This video is the first video of my SEO Basics collection, therefore it is horrible in terms of language and theme (I hope they get better with time). Anyhow for anybody looking for the .htaccess code for the www versus non-www canonicalization it is here:

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