将WordPress主页URL设置为付费会员专业版检出页面并重写/隐藏URL

The Problem:

  1. Set the home page of WordPress to a specific Paid Memberships Pro checkout page (I don't want this to be done via a custom page template). Example:

    User visits: http://www.example.com/

    They're redirected to: http://www.example.com/membership-account/membership-checkout/?level=1

  2. HIDE the URL, so that it reads simply as:

    http://www.example.com/ (the user never knows they've been redirected to a different page template)

What I've tried:

  1. Set the home page to /membership-account/membership-checkout/ via the admin (this url is missing the query string ?level=1). Doesn't work because I'm trying to target this specific membership level. Site redirects to /membership-account/membership-levels/

  2. Modify .htaccess to Redirect the user to the desired page, and then RewriteRule back to the root domain...results in a redirect loop error.

Thoughts for how to approach this?

PMPro developer here. The checkout page requires that ?level=1 parameter or it will try to redirect to your levels page.

There are a few ways to override this behavior by basically telling PMPro which level to assume on the checkout page if none is given. Here is one option, add this to your wp-config.php, active theme's functions.php, or a custom plugin:

define("PMPRO_DEFAULT_LEVEL", "1");

Alternatively, you can set $_REQUEST['level'] in some code directly.

Hope this helps.

Using this in the .htaccess file should do the trick. This will still display as www.example.com in the URL bar but display the membership page.

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ /membership-account/membership-checkout/?level=1 [L]