Block access to your .htaccess file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • razzbee
    replied
    Originally posted by ogah View Post
    if already have this one:
    <FilesMatch ".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$ ">
    Order Allow,Deny
    Deny from all
    </FilesMatch>


    this one is not necessary:
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    FilesMatch uses Regex so its recommended U use the correct and recommended code even though that will work but escape the dot (.)
    the dot must be \.
    so do this :
    Code:
    <FilesMatch "\.(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$">
     Order Allow,Deny
     Deny from all
    </FilesMatch>

    Leave a comment:


  • ogah
    replied
    Originally posted by razzbee View Post
    The following code will prevent user to access your .htaccess file. Also, you can block multiple file type as well.

    # secure htaccess file
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>

    # prevent viewing of a specific file
    <Files secretfile.jpg>
    order allow,deny
    deny from all
    </Files>

    # multiple file types
    <FilesMatch ".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$ ">
    Order Allow,Deny
    Deny from all
    </FilesMatch>
    if already have this one:
    <FilesMatch ".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$ ">
    Order Allow,Deny
    Deny from all
    </FilesMatch>


    this one is not necessary:
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>

    Leave a comment:


  • stefudj
    replied
    Options +FollowSymlinks
    RewriteEngine On
    RewriteRule ^([a-zA-Z0-9_$\-]+)$ index.php?user=$1

    Leave a comment:


  • arnage
    replied
    Search for mod-rewrite, its solved hundreds times for pages and for users.

    Leave a comment:


  • shakil420
    replied
    razzbe bro do u know .htaccess code that user can redirect ... url
    mysite.com/username ++> mysite.com/index.php?user=username

    Leave a comment:


  • standalone
    replied
    yes its on the .htaccess

    Leave a comment:


  • albo0210
    replied
    this code insert on the .htaccess ???

    Leave a comment:


  • razzbee
    started a topic Block access to your .htaccess file

    Block access to your .htaccess file

    The following code will prevent user to access your .htaccess file. Also, you can block multiple file type as well.

    # secure htaccess file
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>

    # prevent viewing of a specific file
    <Files secretfile.jpg>
    order allow,deny
    deny from all
    </Files>

    # multiple file types
    <FilesMatch ".(htaccess|htpasswd|ini|phps|fla|psd|log|sh)$ ">
    Order Allow,Deny
    Deny from all
    </FilesMatch>
Working...
X