.htaccess

From Global Shellz Wiki
Jump to: navigation, search

.htaccess is a good way to limit users' access to a file or directory from your website.

Use them to make configuration changes to the server on a per-directory basis.

Contents

Examples

Block all access

order allow,deny
deny from all

Authentication access

For groups-based access,

AuthType Basic
AuthName "Password Required"
AuthUserFile /path/to/password.file
AuthGroupFile /path/to/group.file
Require Group admins 

For userss-based access,

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /path/to/passwords.file
Require user thewookie

To edit the passwords file, you would need to invoke the htpasswd tool.

$ htpasswd -c /home/t/thewookie/passwd/passwords thewookie
New password: mypassword
Re-type new password: mypassword
Adding password for user thewookie 

Pages redirection

This example redirects /pastes/### to index.php?show=###. It is a real example from http://sourceforge.net/projects/phpaste/ - unless the main project configuration file is set up to link users to index.php paths by default.

# PROJECT: PASTE
RewriteEngine on
RewriteBase /pastes
RewriteRule ^([0-9]+)$ index.php?show=$1
Options -Indexes

Links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox