<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Wordpress: restrict access by IP (wp-admin and wp-login.php)]]></title><description><![CDATA[<p dir="auto">Hi!</p>
<p dir="auto">I have installed Wordpress through the Cloudron App Store, and am trying to restrict access to wp-admin and wp-login.php, using the .htaccess file located at app/code/.htaccess</p>
<p dir="auto">I have tried by adding three different code snippets to my .htaccess-file, without luck (see below).</p>
<p dir="auto">I only achieve that wp-login.php is being blocked for all IP-addresses, and the IP address I try to whitelist gets the same error message as any other IP-address trying to access wp-login.php:  <code>Forbidden You don't have permission to access /wp-login.php on this server. Apache/2.4.18 (Ubuntu) Server at example.com Port 8000 </code></p>
<p dir="auto">The code snippets I have tried without any luck, are:</p>
<p dir="auto">Alternative 1:</p>
<pre><code>&lt;IfModule mod_rewrite.c&gt;
RewriteEngine on
RewriteCond %{REQUEST_URI} ^(.*)?wp-login\.php(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*)?wp-admin$
RewriteCond %{REMOTE_ADDR} !^X.X.X.X$
RewriteRule ^(.*)$ - [R=403,L]
&lt;/IfModule&gt;
</code></pre>
<p dir="auto">Alternative 2:</p>
<pre><code># Block access to wp-admin.
order deny,allow
allow from X.X.X.X
deny from all
</code></pre>
<p dir="auto">Alternative 3:</p>
<pre><code># Block access to wp-admin.
order deny,allow
deny from all
allow from X.X.X.X
</code></pre>
<p dir="auto">(<code>X.X.X.X</code> is where I write my IP address)</p>
<p dir="auto">Any suggestions on what I can do here?</p>
]]></description><link>https://forum.cloudron.io/topic/1541/wordpress-restrict-access-by-ip-wp-admin-and-wp-login-php</link><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Mar 2026 06:54:43 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/1541.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Sep 2018 18:05:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wordpress: restrict access by IP (wp-admin and wp-login.php) on Tue, 06 Nov 2018 15:12:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ahkg" aria-label="Profile: ahkg">@<bdi>ahkg</bdi></a> the reason for whitelisting 172.18.0.1 give access to all requests, is that this is the ip of the Cloudron internal gateway into the subnet where all apps are running.</p>
<p dir="auto">Unfortunately for your case the cloudron healtcheck also comes via this gateway. I think your htaccess file needs to check for the <code>X-Forwarded-For</code> header to check against the correct inbound address.</p>
]]></description><link>https://forum.cloudron.io/post/2515</link><guid isPermaLink="true">https://forum.cloudron.io/post/2515</guid><dc:creator><![CDATA[nebulon]]></dc:creator><pubDate>Tue, 06 Nov 2018 15:12:52 GMT</pubDate></item><item><title><![CDATA[Reply to Wordpress: restrict access by IP (wp-admin and wp-login.php) on Wed, 19 Sep 2018 09:11:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ahkg" aria-label="Profile: ahkg">@<bdi>ahkg</bdi></a><br />
I found some kind of solution (see below).</p>
<p dir="auto">But now I'm wondering if this might cause problems for Cloudron? In the logs, it seems that the Cloudron server have trouble getting access to the wp-login.php, with the check that runs every 10 seconds:<br />
<code>2018-09-19T09:06:45.000Z [Wed Sep 19 09:06:45.296846 2018] [access_compat:error] [pid 207] [client 172.18.0.1:54684] AH01797: client denied by server configuration: /app/code/wp-login.php</code></p>
<p dir="auto"><code>2018-09-19T09:06:45.000Z 172.18.0.1 - - [19/Sep/2018:09:06:45 +0000] "GET /wp-login.php HTTP/1.1" 403 476 "-" "Mozilla"</code></p>
<p dir="auto">I tried to add the local ip 172.18.0.1 to the whitelist in htaccess, but this only resulted in wp-login.php being available to all IP-addresses.</p>
<pre><code>ErrorDocument 401 default
ErrorDocument 403 default

SetEnvIf X-Forwarded-For "^1\.1\.*\.*" AllowIP

&lt;Files wp-login.php&gt;
Order deny,allow
Deny from all
Allow from env=AllowIP
&lt;/Files&gt;

# Block access to wp-admin.
&lt;Files wp-admin/&gt;
Order deny,allow
Deny from all
Allow from env=AllowIP
&lt;/Files&gt;

# Allow access to wp-admin/admin-ajax.php
&lt;Files wp-admin/admin-ajax.php&gt;
    Order allow,deny
    Allow from all
    Satisfy any
&lt;/Files&gt;

# BEGIN WordPress
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
&lt;/IfModule&gt;

# END WordPress

</code></pre>
]]></description><link>https://forum.cloudron.io/post/2316</link><guid isPermaLink="true">https://forum.cloudron.io/post/2316</guid><dc:creator><![CDATA[ahkg]]></dc:creator><pubDate>Wed, 19 Sep 2018 09:11:58 GMT</pubDate></item></channel></rss>