.htaccess – AddHandler

There is a very common problem when trying to upgrade sites made by “newbie” website developers or when you realize that html isn’t the only language on the internet, and you need to upgrade your site.

Problem:

You have a site where every page has a *.html or *.htm extension, and you want to add a dynamic, server-side programming language like PHP.

Solution #1:

Go through your entire site, and change every file name to a *.php extension. Then go through every page and correct all of the hyper links. Then do testing on your entire site to ensure that you haven’t missed any links. Also, if you know anything about search engine optimization and websites, you’ll know you need to create 301 redirects from your old pages to your new so that you don’t lose any Rankings you may have gained. Then you have more testing to do to make sure all of your 301 redirects work….

Solution #2

Add this one line of Code into your .htaccess:

AddHandler x-httpd-php5 .php .htm .html

That’s all it takes to add PHP to my html files?

Yep, that’s it. That little line of code has saved me hundreds of hours of work, and I’m sure it’s not as commonly known as it should be.

-Spread the Wealth
-Ashton Sanders

Google is: Funny

Yes, Google is a lot of different things. One of the things that Google is, is “Funny”

I don’t know who figured this out… but let just say you wanted to drive from Boston, MA to …. France! You could ask Google Maps to give you directions…

And It’s actually a fairly simple process. I’ve got the map saved Here:

Click to Get Directions

I’d like to bring your attention to step 5.

HAHAHA

-“I love Google!”
-Ashton Sanders

SEO – Table Trick

It has been said that Search Engine Optimization “is not yet a science — it’s still an artform.”

I totally agree with that quote. Search Engine Optimization is hundreds of little things that you with your site to make it more search engine friendly. The table trick is one of those SEO things you can do to improve your rankings (however slightly) in the search engines.

Theory

Search Engines don’t usually index your entire page. They usually have a KB limit of how much it will index from each page, and it will probably value the information near the top of a page more than it does the information at the bottom.

Unfortunately, it is the style of the internet to have menu/navigation bars on the left side of the screen. Usually this means that the menu/navigation bar shows up in your code before the content of your web page. So the search engines have to sift through a bunch of formating code in your navigation before it gets to the meat of your site.

Here is where the table trick comes in:

Using this code, you will be able to have a left navigation bar that shows up below the content of your code. Here is the code:

<html>
<head>
</head>
<body>
<table>
<tr valign=”top”>
<td><!– leave this TD empty – it will disappear –></td>
<td rowspan=2>Put the text for the page here. </td>
</tr>
<tr valign=”top”>
<td>Put the Navigation Bar Here</td>
</tr>
</table>
</body>
</html>

That’s it! If you want to see a website that is currently using this trick, go to Front Sight.com.

The above quote and this table trick supplied courtesy of Jere Matlock of Words in a Row. Jere is the best SEO resource anyone could ask for. His site is full of useful Search Engine Optimization tactics and ideas. You can also check out his blog: JMblog.

Another fun quote he has on is blog is:

“If you can’t annoy somebody, there’s little point in writing.”
-Kingsley Amis

-Ashton Sanders

Google Webmaster Tools

Yet another reason why Google is awesome: Webmaster Tools

Webmaster tools is the greatest tool for anyone wanting to get their sites up in the search engines. Search Engine Optimizers who don’t know about this tool, aren’t really search engine optimizers.

You prove to them that you own your website in one of two ways: 1) uploading an .html document to the server with a certain name like Google2903ncvd90nk30.html or 2) add a meta tag to your home page with a similar random name. After that, Google will get you all the information that they have about your site!

The program will tell you all of the crawl errors that the Google bot has while crawling your site! So if your site has gone through a couple redesigns or upgrades, I guarantee there are pages that used to exist that Google can’t find. And everyone of those pages create a 404 error for the Google bot – which, by the way, is not good. But you’ll never know unless you get this tool and find out!

Its got endless tools like that. It has a robot.txt analysis page that will tell you if you have any problems with your robot.txt.

It will tell you how your pages are ranked by Google. It will tell you like 50% of your pages have medium page rank and the other 50% has low page rank. It will also tell you how many links you have directed to your website, and where they are coming from.

Google Webtools also has a place for you to submit your website’s site maps! (Get gsite crawler to create your sitemaps… It makes it as easy as pie.)

And I barely scratched the surface on all of the different tools available to you through webmaster tools.

Check it out
-Ashton Sanders

Cheating the Search Engines?

On the topic of Search Engine Optimization, there are many ways to “Cheat” the Search engines. (Most of these ways are very detectable and you will get penalized for it today, but it was a “good idea” back in the day.)

White Text on White Background: This will alow you put lots of heavy keyword content on your page without having to bother your visitors with them.

Hard to find links: This is where you link a space ” ” or a couple letters and force it to not underline. This way you can direct the search engines to a content heavy page without showing your visitors.

All of these “cheats” will get your site penalized on the Search Engines. This is Google’s first “Quality guidelines – basic principles“:

  • Make pages for users, not for search engines. Don’t deceive your users or present different content to search engines than you display to users, which is commonly referred to as “cloaking.”

(Source: http://www.google.com/support/webmasters/…)

But what about link farms?

A link farm is a system or program that links thousands of sites to your website. Since number of links to your site is one of the main things that Google and other search engines look for, It probably isnt’ a bad idea.

But note, if you get 10,000 links from sites that all have pagerank of 0, your website’s going to have the page rank of 0. So you have to be careful about which program you choose.

I would recommend Link Farms for today, but keep an eye on your page rank, and if it disappears one day, it may because google devised a way to detect link farms.

-Enjoy,
-Ashton Sanders

PHP 301 Redirect: Moved Permanently

Through years of programming websites and Internet database software, etc. I’ve decided to work mostly with PHP. PHP is a server-side scripting language that helps to create interactive websites. It is very useful for creating dynamic pages. (Pages that have one format but fill in different information depending on what information it is given.) This is common in any online store. Every product has the exact same layout, but it has different pictures, and words.

A great thing about PHP is it’s free. It’s largest server-side scripting language competitor, Microsoft’s ASP, isn’t. The PHP syntax is widely used and is very similar to C and Perl.

If I ever have a question about PHP or need information, I always go to http://W3Schools.com. It’s also a great place for beginner programmers to get their foot in the door.

Here is how to us PHP code to make 301 Redirects:

301 Redirect: Moved Permanently
This code is for page redirecting. If you ever change a page name on your website, or take it down, you need to redirect that link to another page. This is because if you’ve had that page up for any period of time, the search engines like google.com or yahoo.com still think that it’s there. Or another site may be linking to it. This will save visitors from getting lost and never seeing your site when they cliked on your link.

Here is the PHP code:

<?
header(“HTTP/1.1 301 Moved Permanently”);
header(“location: http://websitedesign.websitesinaflash.com/”);
exit();
?>

301 Redirect to “www.”
This code I programmed because I wanted to make sure that whenever someone comes to my site, they come to the “http://www.websitesinaflash.com” (NOT: “http://websitesinaflash.com“) So now whenever someone types in my website name without the “www.” It will automatically redirect.

“Who Cares if there is a ‘www.’ in front of your website or not?
The biggest reason for this is so that search engines don’t index two version of the same page. For example, if a Search Engine’s bot find a link to my sight that doesn’t have the “www.” It will index the entire site without it. And if that happens, I’ll have two exact duplicates of my website.

“Wouldn’t that be a good thing?”
No. Search Engines will ding you if you have duplicate content. They see it as an attempt to cheat the system. I knew a man who changed the hosting and domain name for his website. But he didn’t take down his old site. After a couple months, his old site which had had 3-4 Google Page Rank, now had 0 (zero). He realized this and took down his old site, and after half a year, he was back to normal.

Here is the PHP code:

<?
if($_SERVER[‘HTTP_HOST’] != “www.websitesinaflash.com”)
{
header(“HTTP/1.1 301 Moved Permanently”);
header(“location: http://www.websitesinaflash.com” . $_SERVER[‘REQUEST_URI’]);
exit();
}
?>

And there’s my two cents on 301 Redirecting with PHP.

-Enjoy
-Ashton Sanders