Stop page creating domain

Discussion in 'Site & Server Administration' started by mydream, Sep 26, 2008.

  1. #1
    Im not exactly sure how to explain this but my webpage

    example: http://www.test.com

    now i dont have a directly or page setup for

    example: http://www.test.com/test

    How can i stop people from adding things at the end of my domain taking them straight to my website if i didnt create the directory?? Thank You.
     
    mydream, Sep 26, 2008 IP
  2. zone69

    zone69 Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can't stop people from entering whatever URL they wish on the client side but what you can do is redirect people to your homepage if the page is not created since it would return a 404 error. To do this just create a .htaccess text file in your root directory and add this directive:

    
    ErrorDocument 404 http://www.test.com
    
    Code (markup):
    With this if the page DOES exist it will load correctly but if the page DOES NOT exist it will redirect to the page in the directive which in this case is www.test.com.

    Hope this helps!
     
    zone69, Sep 28, 2008 IP