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.

Protecting Non-WordPress Content with s2Membe

Home Forums Community Forum Protecting Non-WordPress Content with s2Membe

This topic contains 3 replies, has 3 voices. Last updated by  Bruce 3 years, 11 months ago.

Topic Author Topic
Posted: Friday Feb 1st, 2013 at 6:31 pm #40315
ricarod
Username: ricarod

Hi everyone… obviously I got the title name from this post: http://www.s2member.com/kb/protecting-non-wordpress-content-with-s2member/ so I read it yes…

Does that means that it works just for php files?

What about html files?

What about URIs under s2members restrictions?

How can I protect files under

http://site.com/Non-WPFolder/filename.html ? It is a Non-WPFolder as you saw but content will only be available for members enrolling via paypal button generated by s2members.

Thanks a ton..

List Of Topic Replies

Viewing 3 replies - 1 through 3 (of 3 total)
Author Replies
Author Replies
Posted: Sunday Feb 3rd, 2013 at 3:13 am #40523
Staff Member

Thanks for your inquiry. ~ We appreciate your patience :-)

Does that means that it works just for php files?

What about html files?

It works only with PHP files. However, ANY file can (even HTML files) be configured to parse PHP tags. Most servers are configured to parse PHP tags inside .php files only. However, a quick addition to your .htaccess file can add support for PHP tags inside other files, which would otherwise be served statically.

Here are some articles covering this topic for GoDaddy, MediaTemple (gs) and HostGator.

On GoDaddy, add this to your .htaccess file.

AddHandler x-httpd-php5 .html

On HostGator, add this to your .htaccess file.

AddType application/x-httpd-php5 .html

On MediaTemple (gs), add this to your .htaccess file.

AddHandler php-script .html
You will need to consult with your hosting company about this to get the correct configuration.

What about URIs under s2members restrictions?

URI Restrictions configured with s2Member® will function properly. Other Restrictions (like Posts, Pages, Categories, Tags) will not be functional, because this type of content does not fall under any of those. It’s custom content. That’s what s2Member’s URI Restrictions are for.

How can I protect files under

http://site.com/Non-WPFolder/filename.html ? It is a Non-WPFolder as you saw but content will only be available for members enrolling via paypal button generated by s2members.

Enable PHP inside .html files as mentioned above. Then follow the KB article example :-) Actually, you could skip the current_user_can() checks that Raam gave in his example if you’re protecting this content through s2Member’s URI Restrictions. Instead, just add the include_once 'wp-load.php'; to the top of any HTML file.

<?php include_once 'wp-load.php'; ?>
Posted: Saturday Feb 9th, 2013 at 8:48 am #41255
ricarod
Username: ricarod

Thank you Jason, what should the expected result should be?

THIS IS WHAT I GOT FROM HOSTING PROVIDER:

“you website is hosted on VPS container with linux platform. I’ve added the .html as server-parsed in the apache handlers section through your cPanel. Now, you will be able to add the .htaccess code for your WordPress application as suggested. Could you please check it again from your end? ”

NOW, what exactly should go to the htaccess? or what else should I ask them?

Thank you…

Posted: Sunday Feb 10th, 2013 at 3:25 am #41307
Bruce
Username: Bruce
Staff Member

Thank you for your reply.

NOW, what exactly should go to the htaccess? or what else should I ask them?

Based on the reply that you posted, your server providers have already set up your .htaccess file to support PHP in HTML files. You shouldn’t need to set anything up any further. :-)

Viewing 3 replies - 1 through 3 (of 3 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.