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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Restrict directory access

    hello everyone,
    this must be fairly easy for you to resolve. I don't know much about .htaccess or RegEx.

    I want to restrict users from accessing the directories. I tried this code "Deny from all". I can get an error message saying "You don't have the permission..." however, I also found out the images are disabled and I can't see themon the pages. Likewise, javascripts are not working either due to this code "deny from all".

    I want to restrict access to directories but not the images.

    Moreover, how do I add a 404 page.

    Thank you in advance. Your help is much appreciated.

    Cheers!

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    So you want it so if they type just the directory into the browser it won't let them see all the files in it?

    You do that in the .htaccess file with
    Code:
    Options -Indexes
    If you do the deny from all as you found out, it blocks out everything from accessing the files in the folder.
    OracleGuy

  • #3
    New to the CF scene
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you very much. Got it!

    One more question. How to rewrite all the .php files to .html?

    Thank you OG.

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Quote Originally Posted by invisible_geek View Post
    Thank you very much. Got it!

    One more question. How to rewrite all the .php files to .html?

    Thank you OG.
    Code:
    RewriteEngine on
    RewriteRule ^(.+)\.html$ $1.php
    Any reason you want to do that though?
    OracleGuy

  • #5
    New to the CF scene
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks again OG. I really appreciate. I believe search engines give more priority to html files. what's your take on this? please enlighten.

    Thanks.

  • #6
    Regular Coder
    Join Date
    Jun 2010
    Posts
    132
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I think search engines index pages without differencing a .php from a .html ....


  •  

    Posting Permissions

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