Rewrite and 404 error pages each have an advantage. Some of their differences:
- 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.
- 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.
- 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.
- 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.