nginx如何設置訪問跳轉到一個固定頁面


方法一

server

{
    listen 80 ;
    server_name  www.xxx.com xxx.com; 
    index   test.html  index.html index.htm index.php;   #直接放置index下
    root /path/to/;

 

}

 

方法二

 

server

{
    listen 80 ;
    server_name  www.xxx.com xxx.com;
    index  index.html index.htm index.php;
    root /path/to/;
    
if ($document_uri !~ 'test.html' ){
     rewrite  ^/(.*)$  http://www.xxx.com/test.html  permanent;   }

 

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM