WordPressログインページ、管理画面にIP制限を設定 ( .htaccess )

概要説明

固定IPが使える環境であれば管理画面はIPでの制限がおすすめです。固定IP環境ではない方はインターリンクのマイIPサービスが簡単でお手頃価格なのでこの機会に試してみましょう。特定のファイルのみアクセス制限の対象外とする記述も掲載しています。

.htaccess
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
order deny,allow deny from all allow from xxx.xxx.xxx.xxx
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx

.htaccessファイルをサーバーにアップロード

/wp-admin/.htaccess

以上で設定したIP以外からはアクセスができないようになります。

IP制限の作業は管理画面からは行わないようにしてください。もとに戻せなくなる可能性があります。

固定IP環境ではない場合

インターリンクのマイIPサービスがお手軽で便利です。 アプリを起動し固定IPを使用したいときだけONにすることで有効にでき、Windows/Macに対応しています。

固定IPでないとお願いできないと行った場合もお仕事も多い業界です。固定IPではない方はいざという時のためにお試ししておくのも良いかもしれません

特定のファイルだけはIP制限の対象から除外する場合

.htaccess
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
<Files ~ "^admin-ajax.php$">
allow from all
</Files>
<Files ~ "^admin-post.php$">
allow from all
</Files>
order deny,allow deny from all allow from xxx.xxx.xxx.xxx <Files ~ "^admin-ajax.php$"> allow from all </Files> <Files ~ "^admin-post.php$"> allow from all </Files>
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx

<Files ~ "^admin-ajax.php$">
allow from all
</Files>
<Files ~ "^admin-post.php$">
allow from all
</Files>

上記のようにファイル名を指定して除外させることも可能です

関連機能

  1. ダッシュボードに自由に使えるメモ用エリアを追加

  2. iframe埋め込みを禁止してクリックジャッキング攻撃を防ぐ

  3. WordPressのRSSフィード機能を無効にする ( feed機能停止 )

サイドバー

よく使うカスタマイズ

最近の記事

アニメの名言集

寂しくない人なんていないのよ
隠せる人が多いだけ

彼女、お借りします
by 水原千鶴

Profile

PAGE TOP
Amazon プライム対象