apache .htaccess access denial

Denying All Access to Others Except Yourself in Apache .htaccess

This article introduces how to deny all access except yourself in Apache server .htaccess file settings. There are cases when you want to make the entire site inaccessible, such as during renovation or when a critical flaw is discovered. For WordPress, you could use plugins, but sometimes it's easier to deny access at the server level like Apache.

Shou Arisaka
1 min read
Oct 24, 2025

This article introduces how to deny all access except yourself in Apache server .htaccess file settings.

There are cases when you want to make the entire site inaccessible, such as during renovation or when a critical flaw is discovered. For WordPress, you could use plugins, but sometimes itโ€™s easier to deny access at the server level like Apache.

Create .htaccess in public_html and add the following. Use your own IP.

Check your global IP at https://www.cman.jp/network/support/go_access.cgi


# Deny all access
deny from all

# Allow by IP address
allow from 60.144.111.111

Share this article

Shou Arisaka Oct 24, 2025

๐Ÿ”— Copy Links