Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    824
    Thanks
    93
    Thanked 18 Times in 18 Posts

    .htaccess disable direct access to a directory.

    I need to disable direct access to 3 folders. So if someone goes to 'www.mysite.com/view' it directs them to a page e.g 'www.mysite.com/noaccess.php' but if my site requests a page e.g.
    PHP Code:
    <?php include ('view/somePage.php'); ?>
    The page would be included.

    How would i go about doign this?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    RewriteCond %{REQUEST_URI} ^/view/(.)*$ 
    RewriteRule ^(.*)$ noaccess.php[L]
    The rules written on htaccess do not affect access to a file via PHP code.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    824
    Thanks
    93
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by abduraooft View Post
    Code:
    RewriteCond %{REQUEST_URI} ^/view/(.)*$ 
    RewriteRule ^(.*)$ noaccess.php[L]
    The rules written on htaccess do not affect access to a file via PHP code.
    Sorry about the slow reply, i forgot to check this post , i just tried that and it didnt seem to do anything :/


  •  

    Posting Permissions

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