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

    I have installed the very latest version MODx Revolution and it seems to be running perfectly from the point of view I can create pages, templts, etc ... I can also view the Home Page fine with edits done to that ...

    Problem:
    The problem I've having is when I add a document (webpage) by duplicating the Home Page, and View that I get the page come up as an error because there is .html on the end of the page url and so it cannot find that ... in other words MODx is not rendering that page from the templates I give it ...

    This also happens when I start a fresh (deleting everything previously) and then use Susan Sottwell's tutorial Build a Site using the ItFits free template ...

    What I don't get is, when I edit and create a new Document, called About Page, within Resources, and use the Home Page template for that page (just to test it with), then View it from MODx Manager, that's when I get the page not found error because it says it's expecting an .html page ... I haven't told it to do that!? ... why isn't the page getting rendered via MODx and show the page as \About US in the browser? ... it's asking for about-us.html! ... do I need to upload the other .html pages? ... I didn't think this was the case as MODx renders all website pages from the pages it creates within the Database? ... all we do is copy the approriate content code, from the supplied pages, into new MODx templates? ...

    Am I right in thinking you can change the original Home page document and the code within the (installed) Default template without MODx getting messed up ... or should these of stayed as they were? ...

    So many questions I know, sorry, but this is confusing the hell out of me ... have I missed something to get this to work properly? ... any help is appreciated ...

    cheers,
    Gem

    This question has been answered by sottwell. See the first response.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Templates have nothing to do with the URL. They provide the HTML structure for the page.

      All resources are automatically given an extension. Resources with children are given a /, so their URL will look like domain.com/parent/. You can configure this in the System Settings, in the Friendly URLs section, the 'container_suffix' setting. Changing it may cause a problem if you are using 'use_alias_path', where you will get a virtual path, like domain.com/parent/child.html.

      The home page normally won't show the alias at all, it's just domain.com.

      Other HTML type resources are given the extension of .html. This can be changed in the Content Types (Content -> Content Types). Each of the types has its own File Extension that you can customize by double-clicking on the File Extension field in the grid.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 44418
        • 6 Posts
        Thank you for those suggestions Susan ... I shall give them a try ...

        cheers,
        Gem
          • 44418
          • 6 Posts
          Hi Susan,

          I tried your suggestions and no change to the error message ... still shows .html in the browser url ...

          Error Message:
          Not Found
          The requested URL /blog.html was not found on this server.
          Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
          Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips PHP/5.3.27 Server at www.tractormug.org Port 80

          I have now backtracked and started all over again ... I have cleared out all resources & templates from the Manager and re-installed the ItFits template into folders you describe in your tutorial ... I have then copied all the code from the ItFits index.html file and pasted it into a template (called Home Page) and then edited the paths to CSS/fonts, etc...

          The Home Page resource (webpage) renders fine and shows as per the tutorial, in the browser ... but if I click one of the other 4 Menu buttons, from that template, it then throws up the error above and still asks for a page with a .html extension ...

          As per your suggestions (I haven't ever touched these):
          container_suffix = default setting = /
          use_alias_path = default setting = No
          Content Types = default settings = Not touched any of these

          All the webpages (resources documents) are using the same Home Page template, just for testing purposes ... and all the resources all have the Resource icon ... that is correct isn't it? ...

          I don't get why it's not rendering the other pages within the browser, when the Home Page works fine? ... if I upload all the ItFits HTML files then it obviously works ... but then they are not inside the MODx Database to be rendered to the browser (i.e. not yet converted to templates) ... plus they cannot be edited using the CMS system because of that ... I'm missing something ...

          Plugin packages installed = Ace, CKEditor, Gallery, SimpleSearch and WayFinder ...

          UPDATE:
          I've left the above to show the progress ...

          I remembered something I did change in the Settings ... I turned friendly_urls ON when I first started using MODx ...

          With friendly_urls OFF the ItFits webpage now works fine with ALL the menu buttons working properly but now shows the Database ID number in the browser instead (i.e. /index.php?id=15) ... ok that's progress, cool ... but now it's not SEO friendly and so the pages won't get indexed by the search engines ... this, I remember, was why I initially switched friendly_urls ON ...

          So I suppose the real question now is, how can I get it all working but with SEO friendly urls intact (by having friendly_urls ON)? ...

          cheers,
          Gem
          • discuss.answer
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            To use Friendly URLs you need to have rewrite rules for your web server. If you are using Apache, then you can simply rename the ht.access file in your site root to .htaccess. This already has all of the rewrite rules MODX needs. If you are using another web server, there are some helpful suggestions here

            http://rtfm.modx.com/revolution/2.x/getting-started/installation/basic-installation/nginx-server-config
            http://rtfm.modx.com/revolution/2.x/getting-started/installation/basic-installation/lighttpd-guide
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 44580
              • 189 Posts
              Susan, Gem might also benefit from reading your cookbook entry: http://modxcookbook.com/add-ons/menus/friendly-urls.html
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Now that's recursion!
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 44580
                  • 189 Posts
                  Almost an infinite loop smiley
                    • 44418
                    • 6 Posts
                    Quote from: sottwell at Jan 22, 2015, 10:28 PM
                    To use Friendly URLs you need to have rewrite rules for your web server. If you are using Apache, then you can simply rename the ht.access file in your site root to .htaccess. This already has all of the rewrite rules MODX needs.

                    Susan,
                    Excellent ... thank you for that tip ... appreciate the help ... everything is working perfectly now ... I do remember reading about the .htaccess file a months ago (with WP) and forgot all about it ... I even deleted the .html ext from Content -> Content Types as you suggested and now all pages just show their appropriate (resource) name ...

                    gissirob,
                    Thanks for the cookbook link ... will have a look at that for other good stuff ... I didn't know that existed wink ...

                    cheers,
                    Gem