Use of RedirectMatch 301 directive in htaccess.To redirect more than a single page using htaccess, you can use the "RedirectMatch 301" directive, which allows you to specify directory matching patterns using regular expressions.
Here 301 redirect is a permanent redirect method which passes between 90-99% of ranking power to the new redirected page and (?i) signifies case insensitivity .
Point to remember:
1. (?i) starts case-insensitive mode
(?-i) turns off case-insensitive mode
2. /directory/cart This is the directory which i am redirecting . When this directory structure will occur in url , page will be redirected to stated page.
3. http://localhost/directory2? This is my new address where i want page to be redirected.