How to redirect folder to homepage in .htaccess

Discussion in 'Apache' started by blackskin, Oct 14, 2011.

  1. #1
    Hello,

    I have some problem with my new site, i have some folder
    admin/
    cron/
    images/
    includes/
    template/

    i want if someone browse mysite.net/admin they redirect to mysite.com

    problem found if i redirect images/ folder.. cause image on my homepage not showing

    here my .htaccess file

    RedirectMatch permanent ^/admin/.*$ http://mysite.net/index.php
    RedirectMatch permanent ^/cron/.*$ http://mysite.net/index.php
    RedirectMatch permanent ^/template/.*$ http://mysite.net/index.php
    RedirectMatch permanent ^/images/.*$ http://mysite.net/index.php
    
    Code (markup):
    please help me to redirect that folder to homepage but if redirect images/ folder i want image still shown on homepage.

    thank you
     
    Solved! View solution.
    blackskin, Oct 14, 2011 IP
  2. #2
    I believe that what you need here is just this line in your .htaccess file:
    Options -Indexes
    Code (markup):
    It will make your folders NON-browsable, while still letting you (or anyone else) open specific file)s) from those folders. If I understood you correctly, then this is what you need. It will apply to all subfolders.
     
    pr0t0n, Nov 1, 2011 IP