0

私がやろうとしているのは、次を使用して、IPアドレスを除くすべてのユーザーを「サイトダウン」ページにリダイレクトすることだけです

 location / {
   rewrite (.*) /sitedown.php redirect;
    allow 94.12.147.139;
    index index.html index.php;
    try_files $uri $uri/ @handler;
    expires 30d;
}

正常にリダイレクトされますが、私の IP がサイトにアクセスすることも許可されません。どんな助けでも感謝します。

4

2 に答える 2

1

以下はうまくいくはずです:

location / {
  #this is the allow/deny/redirect bit
  allow 94.12.147.139;
  deny all;
  error_page 403 sitedown.php;  

  #regular site config when not denied
  index index.html index.php;
  try_files $uri $uri/ @handler;
  expires 30d; 
}

location /sitedown.php {allow all;}
于 2012-10-02T19:45:38.977 に答える