Use of Apache URL REWRITE (mod_rewrite)

Once I was wondering what the use of Apache module - mod_rewrite is. What I will achieve with mod_rewrite kind of heavy module.

I get many answers like I can redirect user to new page without user knowledge. Another case is when document root has changed. Examples are many but I could understand few, as my job is not admin’s job.

One use of apache url rewrite looks very interesting to me. That is rewriting url for search engine optimization (SEO). A concept says that when you have URL with any kind of ID then it is difficult to be cached by search engine. Search engine do not confirm or deny this but experts believe it and they also say that it is good for users also. Visitors can memorize it easily. So url like this: http://laughteryoga.org/shopping/prodReview.php?showMeItemId=62 can be represented like this: http://laughteryoga.org/shopping/prodReview/62/.

This is interesting feature of this apache’s mod_rewrite. Difficult part is that it is based on difficult to remember regular expression. And regular expression is not forgiving.

Another use of rewriting url on high traffic web site is shorting url. See the yahoo site there you will see very short url (like:http://www.yahoo.com/s/688585). Remembering these URLs is not needed by visitors as they are for news etc.