Serve PHP page in web root but show contents in subdirectories

Posted by David on Server Fault See other posts from Server Fault or by David
Published on 2011-11-14T17:00:16Z Indexed on 2011/11/14 17:54 UTC
Read the original article Hit count: 209

I have a web site on a shared hosting server. My directory layout looks like this

/home
    /user
        /public_html
            /pics
                /family

There is an index.php file in public_html. I need help writing .htaccess rules that will

  1. Serve the index.php file when www.domain.org is requested
  2. Force the user back to public_html when www.domain.org/pics is requested
  3. Allow the user to see the directory contents when www.domain.org/pics/family is requested

I experimented with a lot of combinations of RewriteCond and RewriteRule, but I don't understand the documentation and examples well enough to know if what I want to do is even possible.

The web server application is some version of Apache.

© Server Fault or respective owner

Related posts about apache2

Related posts about .htaccess