How to Rewrite Web application ROOT to Another Path or Web Page

The objective of this tutorial is to be able to redirect home page using Apache rewrite engine. Here is how to do it
Lets say you have a website http://www.domainA.com and usually the site will point to a page such
as index.html or index.jsp defined in the httpd.conf using the directive DirectoryIndex.

What if you want the site to point your Website home page to a specific product page say, http://www.domainA.com/myApp?productId=abc

Now if you just do a permanent redirect 301 then the home page URL will say
http://www.domainA.com/myApp?productId=abc, so how do you keep the home page URL still stay
the same while pointing to the new product page.  

You can easily achieve that with the help of apache Mod_Rewrite as shown below ...

RewriteEngine On
RewriteRule ^/$ /myApp?productId=abc [NC,PT]

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.