Redirect visitor from images folder to root directory

Discussion in 'HTML & Website Design' started by JT12, Aug 1, 2012.

  1. #1
    When a user manually navigates to a certain folder on a website (e.g. 'images'), how do you redirect them to the root directory?
     
    JT12, Aug 1, 2012 IP
  2. Thorlax402

    Thorlax402 Member

    Messages:
    194
    Likes Received:
    2
    Best Answers:
    5
    Trophy Points:
    40
    #2
    The best way to do this would be to add a .htaccess file to the directory you want people to be rerouted from. In this file, you will want something along the lines of:

    RewriteEngine On
    RewriteRule ^.*$ /
    Code (markup):
    This is basically telling the browser to redirect any attempt at accessing the current directory to the root directory.
     
    Thorlax402, Aug 1, 2012 IP
  3. JT12

    JT12 Banned

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3

    Right now I am getting the index content, with no styles. It isn't actually redirecting right now.

    I didn't want to be testing in my root directory, so I am testing in a sub-folder with it's own index.

    Example: website.com/website_test/index.php/images.

    Is this throwing something off?
     
    JT12, Aug 2, 2012 IP