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

    I don’t know if its me but when trying to use a document id number in my URL or MakeURL API function my website returns a 404 page not found.

    I have 2 sites in 0.9.6.3 and one in 0.9.6.2.

    Both 0.9.6.3 sites exhibit the same trouble but the later is ok.

    For instance, if I want to goto a FURL address: http://local/modx/login I’m ok but if I want to go to the same address as a docid: http://local/modx/1 it errors.

    Am I missing something? sorry if this has been asked and answered already but I had little success in searching for it.

    Cheers,
    BBloke
      BBloke
    • The old behavior was invalid and caused problems when people used numeric aliases. If you want to access the page by id, use modx/index.php?id=1.
        • 7231
        • 4,205 Posts
        So if the alias is blank you can still use the /id but if there is an alias set then you cannot?
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 2912
          • 315 Posts
          Thanks OpenGeek.

          Well, I’m trying to do $modx->sendRedirect($modx->makeURL($id)); but it keeps completing the URL with a document ID and giving a 404.  Although other snippets using similar code appears to be working as it should be.  Is there something I’m not getting right?

          It’s slowing driving me made sad

          dev_cw, I’m trying to redirect to a page and was hoping that MakeURL and sendRedirect would generate a URL with an alias based upon a docid but all I’m getting is a URL with the alias as the docid which is giving a page not found.

          I’ve had a look at webloginPE which I use and it has the same code and works ok but I’m getting nowhere with my code.
            BBloke
          • I still don’t understand I guess, what does $modx->makeUrl() return for the problem document? What is the problem document’s alias? Is it published? Have you cleared the cache?
              • 2912
              • 315 Posts
              I’m going to temporarily give up on this as there is something wrong elsewhere. Thanks for taking the time to read and respond.

              I’m working with the NewsEditor snippet but have modified it to all for use with TV values. There is no form checking done so it’s all free form input (with exception to a attachement button).

              I have the cache cleared before the redirect, the page is published but nothing is showing.

              Thanks again you two.
                BBloke
                • 7231
                • 4,205 Posts
                I would test to make sure you are getting the correct output from $modx->makeUrl(), then make sure you have all the parameters for $modx->sendRedirect in order as well.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]