Simple .htaccess question

Discussion in 'Apache' started by Imozeb, Apr 26, 2010.

  1. #1
    I have a folder under my main directory called /files/

    How would I write into my .htaccess file a command that would redirect users to www.mysite.com/files/index.html when they type in my websites web address say www.mysite.com ?

    Thanks.
     
    Imozeb, Apr 26, 2010 IP
  2. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Is what I am asking imposible? If so could someone give me a better or alternate solution?
     
    Imozeb, Apr 28, 2010 IP
  3. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #3
    Something like this should work:

    
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
    RewriteRule ^(/)?$ files [L]
    
    Code (markup):
    Put this in your .htaccess file, in your root html folder, and that's it. I tested it... seems to be working fine with me.
     
    pr0t0n, Apr 30, 2010 IP
  4. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It worked! Thank you pr0t0n for your help. :)
     
    Imozeb, Apr 30, 2010 IP