We do not offer support for .htaccess modifications. The following
examples will work on our systems and we offer them as a courtesy
to our customers. Complete documentation on mod_rewrite at http://www.apache.org/docs/mod/mod_rewrite.html
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.
|
Custom Error Messages
Add the following to the .htaccess file::
ErrorDocument 404 /notfound.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.
Denying User Access
Add the following to the .htaccess file:
<Limit GET>
order allow,deny
deny from 128.23.45.
deny from 207.158.255.213
allow from all
</Limit>
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.
Redirect a Machine Name
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 .
Different Default Home Page
Add the following to the .htaccess file:
DirectoryIndex filename.html
Then a request for http://domain-name.net/ would return http://domain-name.net/filename.html
if it exists, or would list the directory if it did not exist.
To automatically run a cgi script, add the following to the .htaccess
file:
DirectoryIndex /cgi-local/index.pl
This would cause the CGI script /cgi-local/index.pl to be executed.
If you place your .htaccess file containing the DirectoryIndex
specification in the root directory of your site, it will apply
for all sub-directories at your site.
Preventing People from Linking to Your Images
Add the following to the .htaccess file:
# Rewrite Rule for images
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.
|