Hello all. I want to create a wp site that has some selected pages and/or posts not available to the public.
How can i go about doing this, have not done it before. Not sure if a password is best(would rather avoid that) or making them only accessible from a specific ip.
Thx
D
You can do this with an .htaccess file (which is literally a file with the name .htaccess
in the root of your website), assuming you’re using Apache.
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{REQUEST_URI} ^wp-login\.php [OR]
RewriteCond %{REQUEST_URI} ^wp-admin
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123$
RewriteRule ^(.*)$ - [R=403,L]
This will deny /wp-login.php
and any URL that start with /wp-admin
from any IP except from 123.123.123.123
. Of course you should change URLs and IP as needed
thx Scallio will look into it.
D