Want to redirect all visitors except for me

前端 未结 4 782
别跟我提以往
别跟我提以往 2021-02-01 07:24

Basically I\'m about to start work on a site and I\'d like something that I can add into my .htaccess file (or elsewhere) that\'ll work like this pseudo code: (my ip will be in

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 07:57

    
    RewriteEngine On
    # Redirect all except allowed IP
    ReWriteCond %{REMOTE_ADDR} !^000\.000\.000\.001$
    RewriteCond %{REMOTE_ADDR} !000\.000\.000\.002$
    ReWriteCond %{REMOTE_ADDR} !^000\.000\.000\.003$
    RewriteRule (.*) http://YourOtherWebsite.com/$1 [R=301,L] 
    
    

    before your wordpress ifmodule this will redirect everyone except the 3 ip address in question.

    You simply ftp to the site and edit the .htaccess file if your IP address changes.

提交回复
热议问题