Travel   Technical   About

Fawas Technical Blog

My technical knowledge to share to the societies.
Back-to-Topic-List Change Dynamic URL to Static URL by .htaccess

eneble mod_rewrite requires before this topic


The change from Dynamic URL to Static URL format is mainly for the search engine spider appriciate


The Dynamic URL is consisted of the URL ormat below, it doesn't good looking for the  search engine spider, some spider are lazy to get discover in that format of url



To the simple and more appriciated format of URLs to the search engine's spiders like must be the following URL format instead of the above one.

and .htaccess configuration can do it on the fly.....


.htaccess is the configuration file that needs to be created in the root directory of your domain (beside your index file)

In the Linux system if there is dot(.) before your file name it means that which file will be hidden automaticly so if you are using the file browser just simply click Ctrl+H to show all of the hidden file

The .htaccess file can be edit by the normal file editor such as Notepad or gEdit

All of the example below would be representing by using the UBuntu OS (Inerfaced) and the gEdit file editor


After the .htaccess has been created, now we will see how to manage it

1. FollowSymLinks must be first set as the security and the engine will not be process if we miss this command

Change Dynamic URL to Static URL by .htaccess

2. RewriteEngine on is just for telling the engine that we are gonna rewrite the engine

Change Dynamic URL to Static URL by .htaccess

3. The RewriteRule is to tells the condition of the URL.


format: RewriteRule condition target



RewriteRule index.php about.php

explain: When there is index.php in the URL, the page will show the content of about.php


Example2(from the picture)

RewriteRule ^travel-([0-9]+).php$ index.php?Wisdom=$1

explain: When there is travel-(any number).php in URL, the content of the page will be show: index.php?Wisdom=(the number of any number)

result1: if we type the content in the page will be of

result2: if we type the content in the page will be of

Change Dynamic URL to Static URL by .htaccess
There is "NO copyright" in, all detail, sentence, picture can be used without asking permission! :)   2005-2018 by Karn (Fawas) Prapertchob