Go Back  HTML Forums - Free Webmaster Forums and Help Forums > TOOLS OF THE TRADE > Website Scripts & Content Management Systems
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 04-05-2003, 06:24 AM
  #1
naveed
Battler (Level 3)
 
Join Date: Jan 2001
Location: Pakistan (West Asia)
Posts: 26
iTrader: (0)
naveed is on a distinguished road
404 page creating

I am trying to create a customized 404 error (Page not found) page.

I have tried following help but failed to done the task

http://www.useyourbrain.co.uk/intern...error-page.htm

Can someone provide me easy help to do this.
naveed is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 04-05-2003, 10:46 AM
  #2
Goldilocks
Super Deity (Level 18)
 
Goldilocks's Avatar
 
Join Date: Mar 2001
Location: Three Bears Cottage
Posts: 3,578
iTrader: (0)
Goldilocks is on a distinguished road
Who hosts your website? I have just done this for my company intranet but then I have direct access to the web server and IIS.
__________________
Goldilocks is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 06-06-2003, 06:36 AM
  #3
GA Media
Adept (Level 5)
 
Join Date: Jun 2003
Posts: 44
iTrader: (0)
GA Media is on a distinguished road
Naveed,

Here is an article i wrote on creating .htaccess files.

Using .htaccess effectively.

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.

There are a variety of functions that you can control using .htaccess some of the more useful of these are explained below:

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, each specific error code is detailed below with the recommended codes to be used in the .htaccess file in bold :

200 OK
206 Partial content
301 Document moved permanently
302 Document found elsewhere
304 Not modified since last retrieval
400 Bad request
403 Access forbidden
404 Document not found
408 Request timeout
500 Internal server error
501 Request type not supported

Using the codes above your error section of the .htaccess file should look like this:

ErrorDocument 301 /notfound.html
ErrorDocument 400 /notfound.html
ErrorDocument 403 /notfound.html
ErrorDocument 404 /notfound.html
ErrorDocument 500 /notfound.html
ErrorDocument 501 /notfound.html

Redirect to a Different Folder
Add the following to the .htaccess file:

RewriteEngine on
RewriteRule ^/oldfolder(.*)$ /newfolder/$1 [R]

This redirects the user from /oldfolder/anyfile.html to /newfolder/anyfile.html, when the .htaccess file is uploaded to the otherwise empty "/oldfolder" directory.

Denying User Access
Add the following to the .htaccess file:

<Limit GET>
order allow,deny
deny from 000.00.00.
deny from 000.000.000.000
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 000.00.00 and from the specific IP address 000.000.000.000 . 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
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 Hot Linking
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.theirdomain.com/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.

Using the above you should, safely be able to publish your sites on the internet knowing that you will not be privy to bandwidth thieves via hotlinking and also, that you will not lose any traffic through pages that are 'not found'.

Article written by Lee.

If you need any more help feel free to post on here or drop me an email

lee@gamediacorp.com
GA Media is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart



 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 05:13 PM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.