We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    Hi,

    I’m a first timer in ModX or Etomite. This is the first time I ever try this kind of CMS that give me a lot of room to modify the CMS as a developer.

    I installed the latest release, version 0.9.0, and it all works just fine so far. The only thing that bother me is the document not found error redirection setting. I set the error redirection on system configuration setting to an id of a page, but for some reason, if I start using a sub folder such as root.domain/subfolder/unknown.page, it will return the modX document parse error page. The address of it seems to follow the alias name and it was prefixed by the subfolder.

    Here is the detailed example:
    1. Accessing http://root.domain/unknown.page
    2. Being redirected to document id number 3, with alias named 404.htm.
    3. Page was displayed with the address http://root.domain/404.htm?refurl=%2Findex.php%3Fq%3Dunknown.page&err=1
    (Here is the problem on sub folders)
    1. Accessing http://root.domain/subfolder/unknown.page
    2. Suppose to be being redirected to document id number 3, with alias named 404.htm.
    3. What happened is, it was directed to the address http://root.domain/subfolder/404.htm?refurl=%2Findex.php%3Fq%3Dunknown.page&err=1

    It seems to me that the system fetch the document based on the error page id being set in the configuration setting, and it fetch the alias named. After that it will append the alias name relative the error page path.

    The same scenario happen, when I used subfolder under subfolder, such as http://root.domain/subfolder/subsubfolder/unknown.page

    The setting that I used for friendly url is on to all the option that are available, except for the autmatically generated alias. I tried to disabled friendly url, and it still displaying the same problem.

    Is this a common behavior on modX?

    Thank you
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
      • 25663 MODX Staff
      • 12,272 Posts
      I’ve seen this issue as well. Could you please log this in the bug tracker so you will receive notifications of status? Thanks!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 22303 MODX Staff
        • 10,725 Posts
        I’ve fixed this issue and am checking it into the code base very soon. For those of you who want to get the fix before the next release hits the streets, here is the modified makeUrl() function (just replace the makeUrl function in your current /manager/includes/document.parser.class.inc.php file)...

        	function makeUrl($id, $alias='', $args='') {
        		$url= '';
        		if(!is_numeric($id)) {
        			$this->messageQuit('`'.$id.'` is not numeric and may not be passed to makeUrl()');
        		}
        		if($args!='' && $this->config['friendly_urls']==1) {
        			// add ? to $args if missing
        			$c = substr($args,0,1);
        			if ($c=='&') $args = '?'.substr($args,1);
        			elseif ($c!='?') $args = '?'.$args; 
        		}
        		elseif($args!='') {
        			// add & to $args if missing
        			$c = substr($args,0,1);
        			if ($c=='?') $args = '&'.substr($args,1);
        			elseif ($c!='&') $args = '&'.$args; 
        		}
        		if($this->config['friendly_urls']==1 && $alias!='') {
        			$url= $this->config['friendly_url_prefix'].$alias.$this->config['friendly_url_suffix'].$args;
        		} elseif($this->config['friendly_urls']==1 && $alias=='') {
        			$alias = $id;
        			if($this->config['friendly_alias_urls']==1) {
        				$al = $this->aliasListing[$id];
        				if($al && $al['alias']) $alias = $al['alias'];
        			}
        			$alias = $this->config['friendly_url_prefix'].$alias.$this->config['friendly_url_suffix'];
        			$url= $alias.$args;
        		} else {
        			$url= 'index.php?id='.$id.$args;
        		}
        		return $this->config['base_url'] . $url;
        	}


        Let me know if this solves your issue.

        Related bug report at http://modxcms.com/bugs/task/109
          • 24253
          • 125 Posts
          For some reason, I don’t get the old behaviour on my site, but a parse error instead. I shouldn’t have changed the configuration smiley

          But the above fix indeed fixes the parser error problem, the redirection points to the correct document now, also with friendly alias path.
          Would of course be nice if this can be tested on multiple installations with different configurations!

          Remon
            • 22640
            • 44 Posts
            Quote from: OpenGeek at Nov 16, 2005, 09:24 PM

            I’ve fixed this issue and am checking it into the code base very soon. For those of you who want to get the fix before the next release hits the streets, here is the modified makeUrl() function (just replace the makeUrl function in your current /manager/includes/document.parser.class.inc.php file)...

            I ran into a similar problem as described above. When I ran the snippet [[WebLogin]] from a file in the root directory and wanted a file within a directory to be a the Login Home page, I would get a ’page not found.’ This of course, with the SEF Urls on. I also have the Friendly Alias Path on as well.

            I replaced the MakeURL code with what you have above, but it didn’t help...same problem. It works fine when friendly path is off, but that is not an option. Any other ideas on what I can try?

            - Glenn
              • 22303 MODX Staff
              • 10,725 Posts
              I can’t reproduce this behavior on my sites. Can you give me any more information about your page structure, like where the login page is, as well as the page it is going to? Also, what version of MODx are you using currently?
                • 22640
                • 44 Posts
                Quote from: OpenGeek at Nov 24, 2005, 09:56 PM

                I can’t reproduce this behavior on my sites. Can you give me any more information about your page structure, like where the login page is, as well as the page it is going to? Also, what version of MODx are you using currently?

                Hi Jason,

                Thats what I was afraid of wink

                I’m using 0.9.0 (x9). I have the WebLogin snippet on my Home Page
                (friendly URLs on, friendly paths on, friendly everything on):
                www.whatever.com/index.php

                When a particular web user logs in I want them to go to:
                www.whatever.com/clients/clothing.php (id=43)

                However, with your revised makeURL I get the doc not found page (same as before I updated it)

                The snippet call is [!WebLogin? &loginhomeid=`43` &logouthomeid=`1`!]

                I have also tried changing the User Login Page to 43 in the User prefs and tried changing the default Login Page in the snippet to 43. But same thing happens.

                NOTE: if I turn off the ’friendly paths’ to no, I will sucessfully go to:
                www.whatever.com/clothing.php upon logging in...the correct page displays, just not in the proper ’directory.’
                I need the original paths to stay intact though.

                Hope I was clear enough! smiley
                Glenn
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Ok, I can reproduce this now, and this is a defect with the WebLogin snippet. If you wouldn’t mind entering a bug record for it, I’ll see what I can do about solving it. embarrassed
                    • 22640
                    • 44 Posts
                    Quote from: OpenGeek at Nov 24, 2005, 11:04 PM

                    Ok, I can reproduce this now, and this is a defect with the WebLogin snippet. If you wouldn’t mind entering a bug record for it, I’ll see what I can do about solving it. embarrassed

                    Thx Jason...will do.

                    Glenn
                      • 32241
                      • 1,495 Posts
                      This might of topic a little bit, but is there any sample tutorial or walkthrough that I can use to enabled user registration and login thrugh the available snippets/ modules? I also wonder, whether it’s enabled for the user to have an extra field different from each different groups?

                      I’m looking forward to the fix of the login snippet as well.

                      Thank you


                      Regards,
                      Wendy Novianto
                        Wendy Novianto
                        [font=Verdana]PT DJAMOER Technology Media
                        [font=Verdana]Xituz Media