We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11054
    • 59 Posts
    I’m working with a simple registration form, and when the person has a successful registration I’m trying to redirect them to another page that the user group has access to.

    The registration follows through successfully and emails are sent out, the user is created in the back-end, but the redirect is giving me major problems.

    This is a site that I’m building in a sub folder of my main site, and then plan to move to my clients site after it is all built, money is in the bank, etc.

    When the redirect takes place, it doubles the sub-folder in the URL so I get taken back to my site 404 page. For example the registration page located at www.mysite.com/subfolder/index.php?id=1, the redirect should go to www.mysite.com/subfolder/index.php?id=2, but it takes me to www.mysite.com/subfolder/subfolder/index.php?id=2.

    This is weird. Here’s my snippet call:
    [!WebLoginPE? &type=`register` &groups=`Volunteers` &notify=`[email protected]` &registerTpl=`VolRegTpl` &regSuccessId=`13` &regSuccessPause=`0`!]
      • 11054
      • 59 Posts
      I’ve spent some time looking into this further, but haven’t made progress. Its seems like it might be an overlap in the way that the site_url is seen by the database and the way that the page id is represented in the database.

      I thought it was specific to this folder, but I have modx running as a sandbox on another subfolder in webserver and when I install the WebLoginPE in that site I get the same result. Is this possibly a bug in the snippet?

      I specifically found this section of the snippet that seems to create the redirect URL, but seeing that I have very little experience with this programming, it made no sense how I could fix it.

      if ($type == ’register’)
      {
      if (in_array(’register’, $disableServices)){return;}
      switch ($service)
      {
      case ’register’ :
      if (in_array(’register’, $disableServices)){return;}
      $registration = $wlpe->Register($regType, $groups, $regRequired, $notify, $notifyTpl, $notifySubject);

      if (isset($regSuccessId) && $regSuccessId !== ’’)
      {
      if ($registration == ’success’)
      {
      $url = rtrim($modx->config[’site_url’], ’/’).$modx->makeURL($regSuccessId);
      header(’Refresh: ’.$regSuccessPause.’;URL=’.$url);
      return $displayRegSuccessTpl;
      }

      Any thoughts on whether this language looks odd?
        • 11054
        • 59 Posts
        Update:

        When the redirect takes place, it doubles the sub-folder in the URL so I get taken back to my site 404 page. For example the registration page located at www.mysite.com/subfolder/index.php?id=1, the redirect should go to www.mysite.com/subfolder/index.php?id=2, but it takes me to www.mysite.com/subfolder/subfolder/index.php?id=2.

        I miss spoke in my original post. It actually forwards to www.mysite.com/subfolder/subfolder/?id=2 (no index.php in the address). Not sure if this provides anything more, but thought it was interesting to note.
          • 24958
          • 4 Posts
          Have you figured out how to get this working? I am coming across the same problem. I guess its not a deal if you have the site in the root of the server, but since we have the site in sub folders...

          Any help will be appreciated.

          Thanks.
            • 11054
            • 59 Posts
            I never worked this out, unfortunately.
              • 27442
              • 103 Posts
              This sounds like it might be a configuration problem. Are you using friendly URL’s? Are you using friendly alias paths? Does your template contain <base href="[(site_url)]"></base>?
                • 11054
                • 59 Posts
                I did not have that in the template as far as I know, but I haven’t yet figured out if this is the problem since I’ve been working around not using this snippet. Once I get back into this project, I’ll report back to see if it was indeed the solution.
                  • 31640
                  • 100 Posts
                  Any news about this issue???

                  I am facing the same problem...
                    • 29440
                    • 1 Posts
                    i have the same problem and i do have a work-around. it’s not a configuration. the code will have to be fixed.

                    the main problem is that webloginpe is written with the notion that your modx web site is run from the web root and not from a subdirectory. replace the line:
                    $url = rtrim($modx->config[’site_url’], ’/’).$modx->makeURL($regSuccessId);
                    with
                    $url = $siteUrl . "index.php?id=" . $regSuccessId;
                    in the case ’register’ : section.

                    putting up the example code section from the snippet posted earlier helped a lot. thanks.
                    i wish i could turn on ’line numbers’ to tell you the exact line number, but i think you’ll figure it out.
                      • 2912
                      • 315 Posts
                      I have a website using modx in a sub folder using registration and haven’t seen this issue. I noticed you mentioned you don’t have <base href=""></base> in your template.

                      Have you something like this in your .htaccess file too?
                      RewriteBase (/websitefolder/)
                      RewriteRule ^(manager|assets) - [L]
                      
                      RewriteCond %{REQUEST_FILENAME} !-f
                      RewriteCond %{REQUEST_FILENAME} !-d
                      


                      ..if you are using FURL’s
                        BBloke