Website of the. htaccess file

Source: Internet
Author: User

The. htaccess file (Distributed profile) in the Apache system provides a way to change the configuration for a directory, that is, to place a file containing instructions in a particular file directory to act on this directory and all subdirectories. Frankly,. The htaccess file is just a simple document that allows you to add simple commands to a variety of different configurations.

Role:

1. Set 404 page

1) How to set up Apache server 404 page

Add code to the. htaccess file:

      

404 /error.html

To establish a simple HTML404 page error.html, put the error.html in the root directory of the site.

2) Set 404 error page under Iis/asp.net

First, modify the configuration of the application root directory to open the "Web. config" file, where you add the content:

<configuration><system.web><customerrors mode="on" defaultredirect= " error.asp "><error statuscode="404" redirect="nofound.asp "></customErrors></system.web></configuration>

where "error.asp" is the default 404 page of the system, "nofound.asp" is a custom 404 page, please modify the corresponding file name when using.

Then, in the Custom 404 page "Nofound.asp", add:

<%"404 Not Found"%>

2. Implementing URL Redirection

We can re-plan the site, migrate the document, or change the directory, at this time, from the search engine or other links from the Web site access may be wrong. In this case, the old URL can be automatically turned to the new address by following the instructions below:

Redirect/Old directory/ old file  name /olddirectory http://www.newsite.com/newdirectory

Website of the. htaccess file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.