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

    I’ve follow the standard steps for enabling URL aliasing, and it should be working. Yes, mod_rewrite is supported by the server. Unfortunately, if I try and visit the desired page, it takes me to the home page, every time.

    With this site, when you type in any non-existant page, it takes you to the home page rather than a 404. I suspect this is whats causing the problem with modx, but I can’t figure out how this was set (by whoever maintained the site before me) - its not set this way in any of the files I would expect: htaccess, 404.php, 404.shtml. Anyone have thoughts on what could be going on?

    Thanks!
    --Peter
      • 8609
      • 607 Posts
      Have you set up your .htaccess file?
        • 22980
        • 84 Posts
        yes. as per the wiki & docs.
          • 22303 MODX Staff
          • 10,725 Posts
          Sounds like mod_rewrite may be enabled, but that AllowOverride is set to None in the webserver, which means .htaccess directives are being ignored.

          As for the non-existent pages going to the home page, this means that MODx is configured with error_page set to the id of the home page. MODx handles all requests to URI’s that are not a real physical file or directory on the web server when the .htaccess rules are enabled.
            • 22980
            • 84 Posts
            This can’t be it. I just ran a quick test and mod_rewrite with .htaccess is working just fine, so thats all good. There’s something else causing the index page redirect, because not only does changing the setting in MODx do nothing, but the page being redirected to isin’t a MODx page, but a static one (index file.) Thoughts?

            --Peter
              • 5950
              • 44 Posts
              Is your installation in a subdirectory? I had a similar (if not exact) problem with a test build in a subdirectory. Once I moved the files to the main directory I was able to use Friendly URLs without a problem.

              I wasn’t able to figure it out until I deleted the old .htaccess file with 404 redirects and was able to see that though my files were in rebuild/ it was looking for /index.php

              If your installation has to be in a subdirectory, be sure to update your Redirect settings in .htaccess

              Hope that helps!
                • 22980
                • 84 Posts
                nope, no subdirectory, unfortunately, but thanks. undecided
                  • 3749
                  • 24,544 Posts
                  You don’t have an index.htm or index.html file in the MODx root by any chance? If so, try renaming it/them.

                  BTW, the error_page setting in Tools | Configuration sets the ID of the "404 page not found" page. By default, it’s set to 1 which is the first document you created (home page, no doubt), so any time MODx can’t find the requested page, you’ll end up there.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 22980
                    • 84 Posts
                    Why would it matter if there is an index file? And what to do that is the problem? There is one, but this is currently a live site (non MODx,) I’m not about to go removing it just to confirm something mysterious..
                      • 3749
                      • 24,544 Posts
                      Well, for one thing, you’ve got two separate sites with the same URL (http://yoursite.com). When someone goes to http://yoursite.com, they won’t get to your MODx site unless you’ve set DirectoryIndex to index.php and, in that case, the users going to the other site with http://yoursite.com will get the MODx site. And search engines may index one of the sites, but not the other. You also have the possibility of conflicting file and directory names. Probably not what you want. wink

                      If you have two different domains pointed to that same URL, you could use .htacess to direct them appropriately, although you might be happier if you put one site or the other in a subdirectory.
                        Did I help you? Buy me a beer
                        Get my Book: MODX:The Official Guide
                        MODX info for everyone: http://bobsguides.com/modx.html
                        My MODX Extras
                        Bob's Guides is now hosted at A2 MODX Hosting