Home Forums Landing Pages [Landing Pages] [SOLUTION] WordPress in Subdirectory and NGINX only

This topic contains 2 replies, has 2 voices, and was last updated by  Hudson Atwell 1 week, 4 days ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #131174

    bbr-hmiller
    Participant

    Hi guys, I just wanted to post this for anyone running into issues with the landing page plugin not switching in this strange WordPress environment.

    I have a WordPress environment where it actually runs straight on NGINX not as a reverse proxy to Apache. Additionally, WordPress is in it’s own subdirectory. There are two issues with this setup:

    • A/B Switching won’t work because the module tries to load wp-load.php from the top directory of the site, not any sub-directories
    • The redirect system the plugin uses that is placed in .htaccess will have no effect because Apache doesn’t exist.
    • You may be using fastcgi caching which could also affect your landing page variations from being served.

    Here’s what I had to do to fix it, which is not a permanent fix, but there’s probably a way to make it more permanent. First, in the plugin file modules/module.redirect-ab-test.php place the subdirectory that your WordPress runs in preceding /wp-load.php. Second, you need to add a redirect in your NGINX config:

    if ($args !~ "lp-variation-id") {
       rewrite (?i)^/go/([^/]*)/?$ /wp-content/plugins/landing-pages/modules/module.redirect-ab-testing.php?permalink_name=$1 last;
    }

    Third if you have caching enabled you will need to have an if statement to match your landing pages and set your skip cache variable.

    I hope this helps someone. It took quite a bit of searching and reading error logs to figure out what was going on, and there’s no documentation here for a similar setup. Thanks!

    #131182

    Hudson Atwell
    Keymaster

    Hi Hunter,

    Best contact all month. Thank you. I hope you don’t mind but I turned your submission into an informative post hosted on the main site. Also put it under your account so you’ll have edit access I believe if you’d like to add onto it. Also setup your author profile for you which you can change if you like.

    https://www.inboundnow.com/use-wordpress-landing-pages-plugin-using-nginx-subdirectory/

    Kind regards,
    Hudson

    #131183

    Hudson Atwell
    Keymaster

    Hi Hunter,

    Best contact all month. Thank you. I hope you don’t mind but I turned your submission into an informative post hosted on the main site. Also put it under your account so you’ll have edit access I believe if you’d like to add onto it. Also setup your author profile for you which you can change if you like.

    https://www.inboundnow.com/use-wordpress-landing-pages-plugin-using-nginx-subdirectory/

    Kind regards,
    Hudson

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.