We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29529
    • 34 Posts
    I’m adding friendly urls to a revo site in development.

    .htaccess files looks like this:

    RewriteEngine On
    RewriteBase /modx/

    RewriteCond %{HTTP_HOST} .
    RewriteCond %{HTTP_HOST} !^www\.mydomain\.org [NC]
    RewriteRule (.*) http://www.mydomain.org/$1 [R=301,L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /modx/index.php?q=$1 [L,QSA]

    In System->System Settings:

    Use Friendly Urls: Yes
    Use Friendly Aliases: No
    Use Friendly Alias Path: No

    This url: http://www.mydomain.org/modx/index.php?id=216

    becomes this: http://www.mydomain.org/216.html

    Unfortunately the latter is apparently not a valid address, so it produces a 404 error . . .

    So it’s loading the site, but not finding the page . . .

    Any suggestions?

    Thanks!

    Terry





      • 3109 ☆ A M B ☆
      • 894 Posts
      Make sure you have these options enabled in system settings.



      Also make sure you are assigning a resource alias to your pages.
        Benjamin Marte
        Interactive Media Developer
        Follow Me on Twitter | Visit my site | Learn MODX
        • 4971
        • 964 Posts
        You can:

        1) enter an alias yourself for each page
        2) have MODx automatically assign an alias for you
        3) I have to experiment to see what happens if you use both 1 and 2
        I could guess that MODx will overwrite your alias and assign an automatic
        one...
          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 29529
          • 34 Posts
          Thanks for the quick replies!

          Automatically generate alias was set to Yes.

          When I set these to yes

          Use Friendly Alias path
          Use Friendly Aliases

          The browser simply fails to load anything . . .

          If I set Use Friendly Alias path to No, it will load the 404 page as before.

          If I set Automatically generate alias to No, the url changes from this

          http://www.easwaran.info/modx/23.html

          to this

          http://www.domain.org/modx/resourcealias.html

          for those pages where I’ve included a Resource Alias

          So it seems that MODx is generating the url as expected - but for some reason it is not valid.

          Any ideas what I can try next?

          Thanks!

          Terry



            • 17499 ☆ A M B ☆
            • 872 Posts
            If it was a MODx error, it would have give you an error 500 not 404.

            Can you re-verify your .htaccess (in case you have forgot to rename it) and your apache configuration (LoadModule rewrite_module modules/mod_rewrite.so) ?
            Empty your site cache and reload.

              • 29529
              • 34 Posts
              Fixed!

              Yes, .htaccess was being parsed - I can force an Internal Server Error by putting in random content.

              But I had it in the site root. Once I moved it into the top directory of the site

              /modx

              it all works as advertised!

              Somewhere in the MODx documentation for Friendly URLs it says that the .htaccess needs to be in the site directory or above it . . .

              At least with my configuration it seems it needs to be in the site directory root.

              I’ll see if I can find that page of documentation and suggest a correction.

              Thanks again!

              Terry