MOD_REWRITE for Dummies

Written by Bobby Handzhiev

Continued from page 1

RewriteRule ^(.*).html index.php?task=$1

What does all that mean? This is a rewrite rule which allows you to make your URLs looking as "static". In this example categories.html will be "translated" to index.php?task=categories. So you no longer need dynamic URL to list ther categories, but can write categories.html

But what do all these strange characters mean? - ^ character marksrepparttar beginning. I.e. you tellrepparttar 143666 server that it should not expect anything before it. - (.*) - This combination isrepparttar 143667 most often used and it means literally "everything". So everything you type before ".html" (i.e. your fake file name) will be passed as: - $1 - This is a parametter, saying whererepparttar 143668 first mask should be put. If you have more than one masks (masks are everything which you use to represent dynamich text or file names) you can use $2, $3 etc. You'll seemor einrepparttar 143669 following examples.

So, if you have categories.html it will be translated info index.php?task=categories, services.html into index.php?task=services etc...

What if you have more than one parametter? First, you should use some characters as delimiter:

RewriteRule ^(.*)-(.*).html index.php?task=$1&language=$2

Here how you can also pass task and language. For example: categories-englist.html will be translated into index.php?task=categories&language=english.

IMPORTANT: If you first write RewriteRule ^(.*).html index.php?task=$1 The second one may not work. You need to always start fromrepparttar 143670 most complicated rule torepparttar 143671 simplest one.

Make it Better: The rule (.*) is too general and often may prevent you of making more complicated rewriting rules. So it is recommended that you "limit"repparttar 143672 rules into something more concrete. Here are a couple of advices:

- Userepparttar 143673 "OR" operator. In our e-shop example we have only few possible "tasks" passed to index.php. Lets say: index.php?task=categories index.php?task=category index.php?task=product index.php?task=services

What will happen if you want to use your static file about.html? It will be rewritten into index.php?task=about and won't work. So you can userepparttar 143674 OR operator and limitrepparttar 143675 rewriting only torepparttar 143676 cases you need:

RewriteRule ^(categories|category|product|services).html index.php?task=$1

This tellsrepparttar 143677 server to rewrite only ifrepparttar 143678 file name is categories.html OR category.html OR product.html OR services.html

- Using "numbers". You can easy limitrepparttar 143679 rewriter to rewrite if it meets only numbers at a certain place:

RewriteRule ^category-([0-9]*).html index.php?task=category&id=$1

With ([0-9]*) mask you tellrepparttar 143680 rewrite engine that onrepparttar 143681 mask place it should expect onlly numbers. So if it see category-english.html it won't rewrite to index.php?task=category&id=english, but to index.php?task=category&language=english (because ofrepparttar 143682 rule we have shown above - RewriteRule ^(.*)-(.*).html index.php?task=$1&language=$2.).

Complete example: Here is how will lookrepparttar 143683 final .htaccess file for our imaginary e-shop:

-------- Options +FollowSymLinks RewriteEngine on

RewriteRule ^(.*)-(.*).html index.php?task=$1&language=$2. RewriteRule ^(categories|category|product|services).html index.php?task=$1 RewriteRule ^category-([0-9]*).html index.php?task=category&id=$1

The author is Senior Deveoper in PIM Team Bulgaria and Consultant in SEO PIM Team

4 Ways To Get Relevant Adsense Ads On Your Site

Written by Mohd Fairuz

Continued from page 1

3- Try refreshing your page again and again until you see relevant ads displayed. You can refreshrepparttar page by clicking onrepparttar 143609 refresh button, or pressing F5 key on your keyboard.

4- If any ofrepparttar 143610 above tricks do not work, you can send an email to Google Adsense Support telling them aboutrepparttar 143611 problem. Don't hesitate. Their support team will reply to your email shortly.

I've experienced this problem with several sites of mine, and it was solved 2-3 days after contacting Google Adsense team.

Mohd Fairuz maintains a website called AdSense Insider Secrets. On his site, he shares with his visitors free tips, secrets & strategies how he managed to boost his Google AdSense earnings by 700%. Go to his website, and get the tips, free of charge at:

    <Back to Page 1 © 2005
Terms of Use