Apache Rewrite and 404 error pages

Source: Internet
Author: User
Tags header advantage linux

Rewrite and 404 error pages each have an advantage. Some of their differences:

  1. The advantage of the 404 error page may be that the rewrite module needs to be called without calling the module. Rewrite As a result, the 404 error pages may be more resource-efficient, making large web sites faster. Most of the static Web pages I've written are currently using 404 errors.
  2. Use 404 error pages and cannot be post and get. For example 305.php?name1=auiou, if this 305.php page is produced with a 404 error, the value of this $_get["name1" will not be read. The <form> of other pages uses the Post method to point the action to 305.php of this 404 error and cannot be received, such as <form Method=post action=305.php> The information sent cannot be received by 305.php.
    If you want to generate a virtual path such as 305.php by post and get, use rewrite to resolve.
  3. 404 the beginning of the error page there are some Linux spaces that must be written in this sentence. Header ("http/1.1 OK");? There are some Linux spaces that must be written as Header ("status:200 OK");? > can be indexed by search engines, otherwise it will be considered as 404 pages. When debugging, you can search the web for "404 Detection Tools" for testing.
    I haven't tested rewrite whether I need to write a statement.
  4. The 404 error page rules are relatively less stringent, so there is a better scope for adaptation. Rewrite are relatively stricter, for example, 305.html and 305-1.html need to write 2 rewrite rules, with 404 error pages as long as one rule. This is another important reason why I use the 404 error instead of using rewrite.


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.