NOTE: This is a collection of information and links collected over the years that might provide useful information. A Safer Company LLC does not guarantee, endorse or approve any of these links or their scripts. Use these links to other websites at your own risk.
- Web Design - IP Addresses
- cookie.txt
- Cookies and Microsoft Vista
- Accept Credit Cards
- FavIcon
- Translate into Other Languages
- Game Development and 3D
- .htaccess
- HTML - Conditional Comments for IE
- Icons
- Advanced Programming
- regular-expressions-cheat-sheet-v2.pdf
- Regular Expression- Regex
- Regular Expressions
- Preg_Replace PHP Function
- SSI - Server Side ludes
- Web Development Tools
.htaccess
The .htaccess file affects how the apache webserver handles requests to a specific directory. The .htaccess file can be used for several things:
Custom Error Messages
- When the web server returns a error message, it is a good idea to have an error messages that is user friendly and looks like the rest of your website.
- First you will need to create the web page that will have the error message for each error. The error codes are listed at the right.
- Next you will need to create or edit your .htaccess file using a test editor like Notepad.
- The format is:
- Examples:
- HTML can be coded directly into the .htaccess file.
ErrorDocument 401 "<body bgcolor=#ffffff><h1>You have to be a <a href="#">member</a> to see this section." />"
- The error message should look something like this and should be added to the .htaccess file:
ErrorDocument ErrorCode /directory/filename.ext
ErrorDocument 404 /errors/404.html
ErrorDocument 401 /errors/401.html
Redirect
The htaccess file can be used to redirect a web page:
redirect 301 /aboutus/about.html http://www.asafercompany.com/aboutus.html
Password Protect a Folder
- Folders may be protected and accessed by only the people who know the userid and password on an Apache web server
- There are two files involved:
- .htaccess
- .htpasswd
- Creating the .htaccess file
- Using a text editor like Notepad, create a file called .htaccess in the folder you want protected.
- You may need to CHMOD to the htaccess file to 644 or (RW-R--R--). This makes the file usable by the server, but prevents it from being read by a browser, compromise your security.
- The .htaccess file should look something like:
- Creating the .htpasswd file (Should be placed above your www root directory)
- Using a text editor like Notepad, create a file called .htaccess
- This file should be saved above the root directory so that they are not accessible by typing www.domainname.com and compromising your security.
- The format is:
UserName: pswrd
webmaster:y4E7Ep8e7EYV This is an example onlyGenerate your username and pswrd for your .htaccess file
Learning .htaccess
Links
- Apache Tutorial: About .htaccess files
- Apache Directives
- Links to Generate the htpasswd file
- AlterLinks - Used 2008-08-21 for BRCH
- Dynamic Drive Online Tools: .htaccess Password Generator
- JavaScript Kit Encrypted Password Generator
- JavaScript Kit has plenty of password protection scripts
- The Site Wizard - .htaccess Tricks and Tips
- Free Password Protection Scripts and User Authentication Scripts
- Comprehensive Guide to .htaccess
- .htaccess Tools
- HTTP Authentication With PHP & htpasswd
- JavaScript Kit Password Protect Tutorial
- Free Password Protection Scripts and User Authentication Scripts
Page last updated: May 31, 2012 10:46 AM
Content and Navigation...