views:

264

answers:

0

Background: I have a site that displays songs with the Post structure of .com/song/foo.html

I am adding every song to an additional child category called "private" that uses a different template (inserts premium content in custom fields), so the structure of the private versions of the Posts will be .com/song/private/foo.html.

Question: How can I edit the .htaccess file in our root folder to do the following:

  1. Block indexing and caching of the ".com/song/private/" folder;
  2. Block all access to the folder;
  3. Allow access for a logged-in Wordpress user;
  4. Allow referral access for any domains I add (so our content partners can list the private pages and allow their customers to click through);
  5. Allow referral access from any of other "/private/" song Post on our domain;
  6. For all others, redirect to the public version of the same post, structured .com/song/foo.html (same filename, just without the "/private/" before it)

We can use mod_rewrite. I have hacked my way through .htaccess edits before, but this is too much for me.

UPDATE: I have now added code to my root .htaccess allowing me to insert another .htaccess in the ".com/song/private/" folder that I need to protect. Now I just need the code to put there.