Firestormhost.com Value Enhanced Web Hosting
main.gif
  HOSTING SOLUTIONS   SHARED HOSTING   RESELLER HOSTING   OTHER SERVICES   FORUMS   DEDICATED SERVERS  

BACK TO MAIN SUPPORT INDEX

Custom Error Messages
Denying User Access
Redirect a Machine Name
Different Default Home Page
Preventing People from Linking to Your Images

Most of these features are now available in you control panel!


For complete documentation on mod_rewrite, please visit 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.

Denying User Access

This may now be done through you control panel too.

Add the following to the .htaccess file:

<Limit GET>
order allow,deny
deny from 123.45.67.
deny from 207.158.255.255
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 123.45.67 and from the specific IP address 207.158.255.255 . 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-bin/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.

  ©2002 - 2003 - Firestorm Network Enterprises, Texas