Results 1 to 3 of 3
  1. #1

    htaccess. - How to restrict operations with any files except index.php

    Please help us to resolve the jam: we need to restrict search, access and other operations with any files except index.php using the htaccess. For example we have a products/ catalogue
    Required to restrict access to any file except the index one.
    So if some visitor tryes to access through the products/ or products/index.php, it should work fine, but if say, thro products/comp.php - then not. We tried to use the following code:

    <FilesMatch ".">
    order allow,deny
    deny from all

    <FilesMatch "index\.php">
    order allow,deny
    allow from all

    Now it works only if the products/index.php is specified
    How can we make it work with the products/ without the index file specified?
    Thanks in advance!

  2. #2
    Join Date
    Jan 2005
    What's you've done is simply disallow access to all files but index.php

    It doesn't sound like this is what you want- you want to stop people from accessing files other than index.php directly, and to only allow access if referred from another file on your site.

    Search this site for things like "disallow image linking" and stuff like that. There should be an answer to what you need under onf of those threads.

    CROWHOST hosting+colocation services | 877-CROWHOST | support at
    Independent remote-hands serving all Chicago data centers

  3. #3
    Ken, Thank you for the idea! - but not sure if it fit there.
    Actualy we need to allow access only to index.php file and to the catalog. The code is fit for the file, so now we need to find the way to restrict/allow access to the cataloque to resolve the problem. If anybody can specify how should we manage in the situation.
    So we need to allow access to catalog products/
    but restrict all of other subdirs and files:
    only allowed variants are:
    1) dir products/
    2) products/index.php (I think it is solved)
    3) + allow something like:
    Last edited by zimin; 07-19-2005 at 03:24 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts