redirect to rootdomain after the first slash in url

Posted by user142397 on Server Fault See other posts from Server Fault or by user142397
Published on 2012-10-23T18:54:21Z Indexed on 2012/10/23 23:03 UTC
Read the original article Hit count: 228

Filed under:

I want to redirect this:

http://www.site.com/xyz

To

http://www.site.com/

Basically i want to redirect to the root domain if a user types anything else after the first slash of my domain name like /xyz or anything else should be redirected or rewritten as the root URL in the browser. Can anybody help? Thanks for your help!

(* This should be only for the first time like when a new user comes to visit my page, because once the page loads for the first time i do not want any re directions as i have different directories, and related webpages. Otherwise my visitor will only see landing page. )

© Server Fault or respective owner

Related posts about redirect