Training

"Winners make choices,
losers make excuses.
"
Decide to be a Winner!!!!

±Arrows Getting Started

± Phase 1
Planning

± Website Tools

± Phase 3
Conceptual Design

± Helpful Information

± Phase 4
Physical Design

± Phase 5
Testing

± Phase 6
Implement and Market Website

± Other Web Development Items

± Multimedia

± Useful Utilities

± Programming

± Advanced Programming

± Microsoft Office Products

± Computer Maintenance

± Other


Web Design

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.

.htaccess

The .htaccess file affects how the apache webserver handles requests to a specific directory. The .htaccess file can be used for several things:

Errors Codes
400 - Bad Request * - generic errors that users can get to by doing some weird stuff with your URL or scripts
401 - Authorization Required *
402 - Payment Required (not used yet)
403 - Forbidden
404 - Not Found *
405 - Method Not Allowed
406 - Not Acceptable (encoding)
407 - Proxy Authentication Required
408 - Request Timed Out
409 - Conflicting Request
410 - Gone
411 - Content Length Required
412 - Precondition Failed
413 - Request Entity Too Long
414 - Request URI Too Long
415 - Unsupported Media Type
Server Errors
500 - Internal Server Error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported

Custom Error Messages

  1. 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.
  2. 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.
  3. Next you will need to create or edit your .htaccess file using a test editor like Notepad.
  4. The format is:
  5. ErrorDocument ErrorCode /directory/filename.ext
  6. Examples:
  7. ErrorDocument 404 /errors/404.html
    ErrorDocument 401 /errors/401.html

  8. 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." />"

  9. The error message should look something like this and should be added to the .htaccess file:

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

  1. Folders may be protected and accessed by only the people who know the userid and password on an Apache web server
  2. There are two files involved:
    1. .htaccess
    2. .htpasswd
  3. Creating the .htaccess file
    1. Using a text editor like Notepad, create a file called .htaccess in the folder you want protected.
    2. 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.
    3. The .htaccess file should look something like:
  4. Creating the .htpasswd file (Should be placed above your www root directory)
    1. Using a text editor like Notepad, create a file called .htaccess
    2. This file should be saved above the root directory so that they are not accessible by typing www.domainname.com and compromising your security.
    3. The format is:
    4. UserName: pswrd
      webmaster:y4E7Ep8e7EYV This is an example only

    Generate your username and pswrd for your .htaccess file

    Enter the user name and password you wish to use for your password protected folder.

    User Name:

    Password:

Learning .htaccess

Links

top of page

Page last updated: May 31, 2012 10:46 AM

It is all about:
Content and Navigation...

Web Site by: A Safer Company LLC