http://www.apache.org/docs/mod/mod_rewrite.html
and http://www.engelschall.com/pw/apache/rewriteguide/
| FRONTPAGE WARNING: Any modifications to your .htaccess file can corrupt your extensions and render your site inaccessible. A backup copy of your .htaccess file should be made before you attempt any changes. |
The .htaccess file is an ASCII text document that can be placed in any directory
on your site. It can be used to control access to files and directories, and
customize some server operation in your site. A .htaccess file can be created in
any word processor but must be saved as text only. You must use FTP software in
ASCII mode to upload or edit your .htaccess file. For the examples provided
here, place the .htaccess file in your root directory.
| FRONTPAGE WARNING: FrontPage sites have a .htaccess file in the root directory that is created when the FrontPage extensions are installed. FrontPage users should proceed with caution and make a backup copy of their .htaccess file before making any changes. Incorrect changes to your .htaccess file can result in your site being unreachable. |
ErrorDocument
404 http://<DOMIANNAME>/error.html
After "ErrorDocument", specify
the error code, followed by a space, and then the path and filename of the .html
file you would like to be displayed when the specified error is generated.
Add the following to the .htaccess
file:
<Limit
GET>This is an example
of a .htaccess file that will block access to your site to anyone who is coming
from any IP address beginning with 128.23.45 and from the specific IP address
207.158.255.213 . By specifying only part of an IP address, and ending the
partial IP address with a period, all sub-addresses coming from the specified IP
address block will be blocked. You must use the IP addresses to block access,
use of domain names is not supported.
order allow,deny
deny from 128.23.45.
deny from 207.158.255.213
allow from all
</Limit>
| FRONTPAGE WARNING: Adding this to your .htaccess will not allow you to publish with FrontPage. You need to keep a copy of your original .htaccess file to replace the modified file when making changes to the site. |
Add the following to the .htaccess file:
RewriteEngine On
Options +FollowSymlinks
RewriteBase /
# Rewrite Rule for machine.domain-name.net
RewriteCond %{HTTP_HOST} machine.domain-name.net$
RewriteCond
%{REQUEST_URI} !machine/
RewriteRule ^(.*)$ machine/$1
This will redirect requests for
the machine name machine.domain-name.net to the directory machine on the site
domain-name.net .
Add the following to the .htaccess
file:
#Rewrite Rule of Images
RewriteEngine On
Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} <URL of page accessing your domain>
RewriteRule ^(.*)$ http://<same as above URL>
You would replace the <URL
of page accessing your domain> above with the domain name and path of
the page that is referring to your domain. For example:
www.their-isp.net/users/mypage/
The RewriteCond directive states that if
the {HTTP_REFERER} matches the URL that follows, then use the RewriteRule
directive. The RewriteRule directive will redirect any reference back to the
referring web page.
Garbled characters are displayed in
some browsers when loading binary files named with extensions that are not
defined in the MIME types defined for our servers.
Using the .htaccess file at the root of your site or in the directory containing
the file with the unspecified MIME type, you can add or change a specific MIME
type. To accomplish this, you would use the AddType directive. The proper
syntax for using the AddType directive is:
AddType MIME-type extension [extension]
For example, you could set it up so that map files with a .GIF extension would
be handled by the "image.gif" MIME type. To do so, you would add the
following directive to the htaccess file:
AddType image/gif .gif
For a binary file type that visitors to your site could download -- rather than
see as garbled text in their browser -- you would add the following directive to
the htaccess file:
AddType application/octet-stream zzz .zzz
(Replace zzz and .zzz with your file type extension.)
If the extension was not already defined at the server-level, the newly defined
MIME type mapping is added to the mappings that are already defined at the
server-level for your account. If the extension was already defined at the
server-level, the newly defined MIME type mapping overrides the pre-existing
server-level MIME type mapping. Note that new MIME types are added to our
servers as those types become available, if your file type is of a MIME type
that would be useful to others, you can e-mail our support team and request that
the MIME type for that file type be added to our servers.
For more information regarding the AddType directive, visit Apache's official
AddType
instruction section.