If you have a website that gets content and data from
database using scripts like PHP…, you will see a url like this
(www.mywebsite.com/data.php?category=client&code=1&offset=0),
that means you try to display your deferent data depending on your visitor’s
request in the same page like in the example above “data.php”, there is nothing
wrong with that specially when you have a big website and you can not every
time update products, client…, that is a dynamic URL, like the example above
driving data from database every update or changes and the content changes in
every display , now what is the opposed of dynamic url , it is static url which
I think you already figure it out from what I said above , it is a page that
does not change and contains same data without the interfere of the webmaster. so
I think you like the dynamic url because it have a lot of advantage and saves a
lot of time, always fresh content without a lot of effort from the webmaster every
thing done by scripting , that is the big advantage
But when it comes to SEO (Search Engine Optimization) there
is a weak spot , search engines dislike dynamic urls, so how we can change our dynamic url to look
perfect for the search engines to earn some “blessing” from them , there is many way including using php scripting
it self but to day we will go so simple than scripting , we going use .htaccess
it is a simple ASCII file that you can create using a text editor, like NotePad
for example but you have to make sure, when you create an htaccess file to
chose “save as type *.* “ when you try to save the file and then in the name
type .htaccess with a dot in front of htaccess (if some editors does not let
you to save it as mentioned you can always save it as htaccess and then rename
it and add the dot in the front) now you know how to create htaccess file ,
lets get to the business
How to change a dynamic url to look like a static url to
rank better and to be indexed easy in search engines.
For example
you have a url that
looks like this http://www.mywebsite.com/clients.php?category=software&country=usa
you can change it to look like http://www.mywebsite.com/clients-software-usa.html
Step 1
edit the .htaccess and add the 2 lines below
RewriteEngine on
RewriteRule ^clients-(.*)-(.*).html$ /clients.php?category=$1&country=$2
Now save the .htaccess file and upload it using ASCII mode
in your ftp to your hosting in the same directory where clients.php is located
at
Step 2
Now edit the files that links to clients.php using the link
that looks like this
<a href=”clients.php?category=’.$category.’&country=’.$country.’”>
or it may look like this
<a href=”clients.php?category=’.$data[‘category’].’&country=’.$data[‘country’].’”>
depend on how your code looks like but now you have to change it to this
<a href=”clients-’.$category.’-’.$country.’.html”>
or this
<a href=”clients-’.$data[‘category’].’-’.$data[‘country’].’.html”>
and save the files and upload them to your hosting or server
and you are done , in a simple way when your clients clicks on the link
<a href=”clients-’.$category.’-’.$country.’.html”> which will look like www.mywebsite.com/clients-software-usa.html
in the web browser of your visitors or robots will index it that way , the
htaccess will “convert” that link to your old dynamic linke and gets the data
but still the web browser will keep the new link and that is what we want , that way search
engines will rank you higher and faster .