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