I host a wordpress site on apache / mysql with Hostinger. In addition to some posts and simple content pages there is a parent page /members/
and child pages under it which are available only for logged in members, like so:
/members/
/members/lorem/
/members/ipsum/
/members/dolor/
I think it could be done with .htaccess
is to check for a wordpress logged in cookie and set cache / expires headers to stop caching.
I'm looking for a way to use .htaccess
to prevent caching of any pages with the word member
in the URL. I've seen some examples that work using <FilesMatch>
but they only check the filename and extension, not the whole URL to match a pattern before the filename. I've also seen that <location>
, <directory>
and <directorymatch>
could be used but only if the host provider gives you server access to do so which I don't have.
I can't find a solution that works using the .htaccess
file or a combination with wordpress and custom PHP.
My permalinks settings in wordpress is set to 'Post name' and my .htaccess
file currently contains:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Note: I don't want to use a plugin to do this for various reasons.