Nginx Specify 404 error page Jump

Source: Internet
Author: User

Demand:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/54/81/wKiom1SFIVXCUvg1AAGuMaUK6bI246.jpg "title=" qq.jpg "alt=" Wkiom1sfivxcuvg1aagumauk6bi246.jpg "/>

Modify the configuration file to jump:

server {        listen        80;        server_name shadouyou.com www.shadouyou.com;             if  ($host  =  ' Shadouyou.com '  )  {        rewrite ^/(. *) $ http:// www.shadouyou.com/$1 permanent;                 }        root   /disk/var/www/ index;        include /etc/nginx/conf.d/shadouyou-seo;         location / {                 index  index.html index.htm;         &nbsP;               proxy_set_header  HOST    $host;                         proxy_set_header X-Real-IP        $remote _addr;                         proxy_set_header  x-forwarded-for  $proxy _add_x_forwarded_for;                 if  ( !-e  $request _filename )  {                          proxy_pass      http://index;                 }                 if  ($request _uri ~* newsinfor.*)  {                          rewrite ^ (. *) $ /404.html last ;                 }        }         error_page 404  /404.html;         location = /404.html {                 root   /usr/share/nginx/html;         }

When the client accesses www.shadouyou.com/newsinfor_XXXX.html, it is rewritten by the last if intercept to the 404.html location below to upload a 404 HTML file of its own in the root directory.

This article from "Loyalty" blog, declined reprint!

Nginx Specify 404 error page Jump

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.