1 |
.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 |
2 |
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 |
3 |
2. RewriteEngine on is just for telling the engine that we are gonna rewrite the engine |
4 |
3. The RewriteRule is to tells the condition of the URL.
format: RewriteRule condition target
Example1 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 fawasblog.com/travel1.php the content in the page will be of fawasblog.com/index.php?Wisdom=1 result2: if we type fawasblog.com/travel8.php the content in the page will be of fawasblog.com/index.php?Wisdom=8 |