Archive for October, 2007

ASP, PHP, .Net, JSP or HTML which is good for SEO ?

Wednesday, October 24th, 2007

Its a very funny question anybody in Internet marketing industry will come across.

To me if you ask the same question, I would say it doesn’t matter at all

Why

Search Engine crawlers are like a normal user, they cant see what is the code written at the server level to output a page. So what a crawler/regular user will be getting is a page coded in HTML. (I am using HTML as a generic term, leave behind xhtml , wml etc).

Again another argument is that having all the files with .htm or .html is advantageous in SEO. I cant comment on this strongly, but still as of now there seem no algorithm exist to give rating based on the file extension.

Stick to basics

Having .htm or .html extensions/files in a site is advantageous too. If they are plain html pages, they load faster as it doesn’t go through the parsers such as ASP parser, PHP parsers etc. When a file is requested by client, the web-server just need to respond with the file without processing the server sided code in it, because they don’t have any..

But nowadays the web-servers are quite capable to send out processed server sided scrips without much delay, so you cant really differentiate the response times of plain html and pages like ASP,PHP etc.

Another disadvantage of websites using server sided scripts is the over usage of query parameters in URL. Its very easy to use a single server sided page and show different page outputs depending on the query parameters. This should be avoided as far as possible.

One can make use of URL rewriting to hide such lengthy URL’s having some many special characters such as ‘&’, ‘#’ , ‘?’ and show a very friendly URL with an ending file extension .htm or .html !!

Apache’s Mod_Rewrite magics

Wednesday, October 24th, 2007

First lets see what is mod_rewrite

mod_rewrite is basically an apache module, using which we can play around with the URL’s

 Configuration

You need to cross check in your httpd.conf whether the following lines are present

LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c

If its not there, make sure to add it along with the other modules of apache which is mentioned in httpd.conf

again check for the directives mentioned for the directory block where your scripts reside.

thats something withing <Directory ..></Directory> tags

Inside which make sure you have the following line for AllowOverrides

AllowOverride All

See Apache’s documentation for further info on the above configurations.

Put into action

create a file with name .htaccess in your website/folder where you would like to make fancy url’s. say we have kept in a folder /fancy

Now edit the .htaccess file and type in following.

#### URL Rewriting example by Ramkumar – 08032007 #####

Options +Indexes
Options +FollowSymlinks
RewriteEngine on
RewriteBase /fancy
RewriteRule ^(.*)/(.*)/(.*)\.html$ index.php?c=$1&s=$2&p=$3 [L]
RewriteRule ^(.*)/(.*)\.html$ index.php?c=$1&p=$2 [L]
RewriteRule ^(.*)\.html$ index.php?p=$1 [L]

In the above code, see the line RewriteBase /fancy , which is very important, this says from where the rewrite rules need to be applied (the folder)

Now create a php page with following contents.

 <?php
$page=$_GET['p'];

if(isset($_GET['c']))
echo “<h2>You are on category: <font color=’#FF0000′>”.str_replace(“-”,” “,$_GET['c']).”</font></h2>”;
if(isset($_GET['s']))
echo “<h3>You are on subcategory: <font color=’#FF0000′>”.str_replace(“-”,” “,$_GET['s']).”</font></h3>”;

echo “<h4>You are viewing page: <font color=’#FF0000′>”.str_replace(“-”,” “,$_GET['p']).”</font></h4>”;
?>

Open the page in browser under your webserver and try following URL combinations

/fancy/first/second/third.html

/fancy/first/second.html

/fancy/first.html

You are sure that the files corresponding to above URL’s  doesn’t exist in server, but you will still see a valid page (provided the mod_rewrite is working fine). If it works, thats the example of URL manipulation using mod_rewrite !!

Create overlays in a webpage using lightbox.js

Wednesday, October 24th, 2007

LightBox.js is a simple script with which you can use to show overlays on your page similar to snap feature in wordpress.com

Proceed to huddletogether.com/projects/lightbox/ to download the latest version of lightbox.js !!