latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

How to protect a folder outside web root ?

Home Forums Community Forum How to protect a folder outside web root ?

This topic contains 13 replies, has 2 voices. Last updated by  Bruce 4 years ago.

Topic Author Topic
Posted: Thursday Dec 6th, 2012 at 11:39 am #33710

Hello,

I need to put my downloadable content outside web root.
Is it possible and how to ?

I have from my server “….vhosts/www/mydomain.com/httpdocs/” This is web root
But i need to put my protected content here : “…/vhosts/www/mydomain.com/pretectedfolder/”

I have a hack like this http://www.s2member.com/forums/topic/using-other-folder-instead-of-s2member-files/

List Of Topic Replies

Viewing 13 replies - 1 through 13 (of 13 total)
Author Replies
Author Replies
Posted: Thursday Dec 6th, 2012 at 3:30 pm #33748
Bruce
Username: Bruce
Staff Member

Hi Emmanuel,

This article should be helpful:

Knowledge Base » Protecting Non-WordPress Content with s2Member

Posted: Thursday Dec 6th, 2012 at 4:45 pm #33783

Hi,
It’s not a document outside wordpress that I wish to protect.
I just want to modify the location of the security-enabled directory, and this location is outside the web root.

Posted: Thursday Dec 6th, 2012 at 4:54 pm #33785
Bruce
Username: Bruce
Staff Member

Hi Emmanuel,

Try it like this:

Posted: Thursday Dec 6th, 2012 at 5:08 pm #33786

Sorry always the same message : The security-enabled files directory (/var/www/vhosts/mydomain.com/mysecuritydirectory) does not exist.

Posted: Thursday Dec 6th, 2012 at 5:37 pm #33797
Bruce
Username: Bruce
Staff Member

Emmanuel,

I just ran a test on this and it appears to be functioning correctly. I believe that the problem here are the permissions of the folder. Can you try setting the permissions of the folder to 775?

Posted: Friday Dec 7th, 2012 at 1:23 pm #33906

Always the same message…

This is directory info :
user www-data
group www-data
chmod 775

My server run whith plesk

Posted: Saturday Dec 8th, 2012 at 2:22 pm #34000
Bruce
Username: Bruce
Staff Member

Emmanuel,

Can you try adding the following line to the end of your new directory?

.((stripos(PHP_OS, "win") === 0 && stripos($_SERVER["SERVER_SOFTWARE"], "apache") === false) ? "/app_data" : "")
Posted: Sunday Dec 9th, 2012 at 5:36 am #34044

Can you try adding the following line to the end of your new directory?

I don’t undestand what you mean by new directory ?
Can you explain a little more ;-)

Thank you

Posted: Sunday Dec 9th, 2012 at 2:52 pm #34066
Bruce
Username: Bruce
Staff Member

Instead of

Posted: Monday Dec 10th, 2012 at 4:26 pm #34178

Hello Bruce

well i try again but it don’t work. Sorry
I think i will try with a classic folder into the root.

Can you read my code, may be a mistake that i can’t see ;-)

<?php
add_filter('ws_plugin__s2member_files_dir', 'my_files_directory');
function my_files_directory() {
return ABSPATH.'/var/www/vhosts/mydomain.com/myfolder/'.((stripos(PHP_OS, "win") === 0 && stripos($_SERVER["SERVER_SOFTWARE"], "apache") === false) ? "/app_data" : "");
}
?>
Posted: Tuesday Dec 11th, 2012 at 1:12 pm #34275
Bruce
Username: Bruce
Staff Member

Try this:

<?php
add_filter('ws_plugin__s2member_files_dir', 'my_files_directory');
function my_files_directory() {
return ABSPATH.'../myfolder/'.((stripos(PHP_OS, "win") === 0 && stripos($_SERVER&#91;"SERVER_SOFTWARE"&#93;, "apache") === false) ? "/app_data" : "");
}
?>
Posted: Tuesday Dec 11th, 2012 at 4:46 pm #34300

Thanks for your help but it’s still don’t work.
I will try an another directory inside root.

Thank you

Posted: Wednesday Dec 12th, 2012 at 1:50 pm #34395
Bruce
Username: Bruce
Staff Member

Hi Emmanuel,

I’m going to send this to our development team, so they can run some tests on this.

However I just want to bring up a point that users *cannot* access the /wp-content/plugins-s2member-files/ directory, as s2Member uses special .htaccess rules that make it impossible to access outside of s2Member’s processes./

Viewing 13 replies - 1 through 13 (of 13 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.