Htaccess

From Logicalwebhost-Wiki

Jump to: navigation, search

htaccess controls who looks at a directory from the web. You have to make 2 things, the file that locks the directory, called .htaccess, which you put in the folder you want to protect, and then you make .htpasswd and put it somewhere you reference in the .htaccess file. So you create the .htaccess file, then you run a command and make the .htpasswd.

[edit] how to do it

  • htpasswd -c /whateverdir/whatever_folder/passwords whateverloginname
tells the system to password protect /whateverdir/whatever_folder/ by requiring the password that you specify by running that command over there, then it stores the authencation file wherever you run the command from so then you have to create a file called .htaccess inside whatever directory you want to password protect, and make sure the apache user owns it :)
 AuthUserFile /pathtowhereyouwantthepasswordfile/.htpasswd
 AuthName EnterPassword
 AuthType Basic
 #
 require valid-user
If you haven't already, you have to change AllowOverride in Apache conf file to:
AllowOverride AuthConfig
you can also do that in a virtual directive if you need when you're done, reload apache to enable it
  • htpasswd ./password_filename newuser
adds another user to the file you already created with the htpasswd -c command

[edit] .htaccess rewrites using modrewrite/php/mysql

http://www.lucabiagini.com/2008/03/php-mysql-htaccess-friendly-urls/

Download wordpress, open wp-includes/formatting.php and clone/edit the following functions:

- sanitize_title_with_dashes - remove_ accents - seems_utf8 - utf8_ uri_encode

Personal tools