Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use htaccess to restrict one wordpress site but not all in multisite
    text
    copied!<p>I have researched this and unfortunately all I can find is general advice on htacesss and pass wording or general htaccess to redirect etc. None of them are what I am after here.</p> <p>To sum up, we run a set of blogs all using the WordPress Multisite functionality.</p> <p>All these files etc and info in the database are referenced by an ID and as such the site does not live in a folder.</p> <p>I want to restrict one folder with a htaccess that our company uses to allow access to its users.</p> <p>Normally I would drop that file in the folder and job done.</p> <p>However, as mentioned there are no physical folders and so I need to somehow add this to the existing htaccess file that WordPress uses to handle everything.</p> <p>Here is the htaccess file as standard:</p> <pre><code>RewriteEngine On RewriteBase / #uploaded files RewriteRule ^(.*/)?files/$ index.php [L] RewriteCond %{REQUEST_URI} !.*wp-content/plugins.* # deperectaed after upgrade to v. 3.0 RewriteRule ^(.*/)?files/(.*) wp-content/blogs.php?file=$2 [L] RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L] # add a trailing slash to /wp-admin RewriteCond %{REQUEST_URI} ^.*/wp-admin$ RewriteRule ^(.+)$ $1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule . - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L] RewriteRule . index.php [L] &lt;IfModule mod_security.c&gt; &lt;Files async-upload.php&gt; SecFilterEngine Off SecFilterScanPOST Off &lt;/Files&gt; &lt;/IfModule&gt; </code></pre> <p>What I need to add is the following:</p> <pre><code>AuthName "You must be a valid user" AuthType Basic require valid-user </code></pre> <p>But I only need it to work on one site, say site id=2 for now. I would possibly like to add sites to this later.</p> <p>Any help will be greatly appreciated.</p> <p>Cheers</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload