- About us
The purpose of writing this tip is that somedays before I was almost lost in my current project. It was miserable for me to find out how and where a particular event is fired to execute a particular functionality though it was understandable that the event was fired because whenever I changed something in the event-handler of that particular event the changes were reflecting in the application. Then after a lot of searching and researching I found out a new thing (for me) called “URL Rewriting” as the cause of this happening. Now, lets discuss briefly about the concept “URL Rewriting”.
WHAT IS “URL Rewriting” AND WHY TO USE IT :
The URL Rewriting rule is one the best concept we can use for increasing the searching capability and usability of the developed websites by us in the search engines.
Ex: We have created an application in ColdFusion which contains the product searching feature. So whenever we like to search some product like 'pencil' or anything, a particular ColdFusion service is called or an event is fired to call that service to give us all the data regarding the search resullts of pencil from the database. So, our URL in the web browser for that functionality will be almost like: ( in general )
Then, from the URL also we can say that we are searching for pencils and its not at all difficult to remember the URL. And also we cannot say by seeing the URL that which technology we have used for the application which is good.
To use URL Rewriting we need to first create a file called '.htaccess.txt' or 'rules.htaccess.txt' to contain all the rules to change or translate the URLs and put it under the root folder of the server in our system. If previously the root directory contains this file, then we should edit it instead of overwrite it.
RewriteRule ^products/([A-Za-z0-9-]+)/?$ /search_product.cfm&product=$1 [QSA,L]
The above rule will translate the URL like :
URL Rewriting, Website Searching, ColdFusion