You are currently browsing the Ecommerce Web Hosting weblog archives for October, 2007.

Categories

Archive for October, 2007

Search Engine friendly URLs using apache’s mod_rewrite

Tuesday, October 30th, 2007

In my last tutorial i described how to use PHP for SE friendly URLs. This time its inverse. Here you will get to know how to use Apache’s mod_rewrite for SE friendly URLs. Here we go:

Installation and Enabling mod_rewrite (Skip this if you are not the server administrator)

First on a *NIX machine, you would have to compile the module with appropriate options. This module is usually shipped with apache; but in case you want to upgrade, etc, etc.

After compiling it, to add it to the list of modules so that apache (httpd) will load it during startup use these:

apache/httpd 1.3.x :

LoadModule rewrite_module modules/mod_rewrite.so

AddModule mod_rewrite.c

apache/httpd 2.2.x :

LoadModule rewrite_module modules/mod_rewrite.so

——————-

Configuring Mod_Rewrite in httpd.conf OR .htaccess :

Now, for example there is a URL with you like ” something.com/abcd/pqrs/tpop/index.php ”

you could simply make it something.com/file.html by using this in httpd.conf OR .htaccess :

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^file.html /abcd/pqrs/tpop/index.php

—–

You can specify unlimited no. of RewriteRules.

The syntax is:

RewriteRule <^false URL/Alias required> <Original URL>

Notice the space between the two URLs!! Don’t mix up them else it won’t work!!

Now the question arises that “What do I do if I have a dynamic system which uses HTTP GET parameters to show the content ? ”

Here’s the solution for this:

consider a url like this: something.com/index.php?do=viewarticle&id=123

and you want a URL like something.com/articles/123

Now, in .htaccess OR httpd.conf use these lines:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^articles/[0-9]+ /index.php?do=viewarticle&id=$1

——-

Here [0-9]+ means there can be any number between 0 and 9 and their repetition.

You can use also a combination of other Regex expressions to achieve your goal. What i tell you here is the tail of an elephant ; the whole elephant is still remaining !!

Well, the syntax for this type is:

Options +FollowSymLinks
RewriteEngine On
RewriteRule <^Fake URL+ Regex> <Original URL and $1 for first regex then $2, & $n for nth regex>

That’s all for now!

SEO friendly URLs without using apache’s mod_rewrite

Saturday, October 20th, 2007

This tutorial shows how to setup SEO friendly URLs without using apache’s mod_rewrite.

Sometimes on large sites, mod_rewrite turns to be slow; hence overloads the server. So, here’s a tutorial to use SEO without mod_rewrite:

In the file which shows the content from the database, will have this code or a code similar to this.

Considering a URL: something.com/something.php?id=335

something.php will have this:

$article_id = $_GET[’id’];

$article=mysql_query(”SELECT article FROM articles WHERE ID=$article_id”);

print $article;

That’s just a simple code not for a use.

We want the URL something like this:

something.php/id/335

So for it, we modify the code in something.php to this:

$rq_dat=explode(”/”,$_SERVER[’PATH_INFO’);

now, the URL something.php/id/335

is broke in the script to

$rq_dat[’0′]=id

and

$rq_dat[’1′]=article id (335)

Now, we put this in the mysql_query()

mysql_query(”SELECT article FROM articles where ID=$rq_dat[’1′]”);

Isn’t it simple ?

The next problem is that we have the .php extension in something.php/id/335

To remove it, you have to setup a in the .htaccess file.

ForceType application/x-httpd-php

OR

ForceType application/x-php

OR

ForceType application/php5-script (php5 only)

Now rename something.php to something

It should work.

Note: This tutorial is published without any warranty. For any damage incurred, ecommercewebhosting.org OR any of its affiliates/authors will NOT be responsible. Use at your own risk

How Spammers Get Your Email Address

Wednesday, October 3rd, 2007

Each minute of each day, there are literally thousands upon thousands of spam email messages flooding inboxes the world over. Some of that email even goes out from what appears to be your very own email address! Where on earth do spammers get your email address? There are various ways - some are legitimate, and most are not.
Typically, spammers will “harvest” email addresses from legitimate web sites, such as USENET groups, chat rooms, message boards, AOL profile pages and special interest group postings. These are sites you have visited and requested more information from, or corporate sites where you may have placed an order.

The spammers collect these addresses using automated programs called spambots. Spambots are designed to harvest the email addresses from these web sites. They scan every page on the site, collecting any text containing the symbol “@” they find. The email addresses they collect are compiled into a database, loaded into a bulk-emailing program and out goes the spam. Often, these harvested email addresses are also sold to other spammers ; once you email address makes it to a spammer’s mailing list, it will make it onto their fellow spammer’s lists.

Some websites require you to register before you can place an order or access certain parts of the site. Not all these websites will be as protective of your email address as you may wish. Newsgroups are particularly notorious for exposing their users’ email addresses to the spam gatherers. Most newsgroups do not take a great deal of care to hide the email of their users, and each and every email member email address is exposed and up for grabs by spammers. Some of the wbsites that aask you to register may also sell to spammers.

Another method commonly used by the spammers is to target a domain. They simply guess or make up every possible variation of email address based on the domain name, for example @yourDomain.com . They create a mailing list of these addresses and then spam them. Corporate emails are especially vulnerable, as their emails have a distinct format such as @BusinessName.com.

While most of the spam will bounce, it really does not bother the spammers because they can and do send out millions of this type of junk mail a day. A small proportion of the emails will actually be legitimate and will receive the spam - that is good enough for the spammer. This method of gathering email addresses is called a brute force spam attack.

One way to defend against this is to make it more difficult for the spider to harvest your email. When you place your email address on a web site, remove the @ symbol and replace it with the word “at.” This makes it far more difficult for the spam harvester to gather your address, because it cannot be gathered mechanically; it can only by read by a human who is actually reading the site. Alternatively, you should display your email address as an image rather than as text.

Technorati Tags: , ,