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

    I'm very new to MODx and I would consider myself a intermediate web developer.

    I'm playing around with latest MODx Revolution on a MAMP install. Yes, mod_rewrite is enabled.

    I turned on FURL, put the .htaccess in the right place.

    Rewriting is working, but all URLs are taking me to the base directory.

    For Example: localhost/modx/ANY.URL.HERE is showing me localhost/modx/

    I'll paste my .htaccess file below. I'm sure this is a very easy fix, however I've been working too long and can barely see past my own nose smiley

    ------------
    # MODX supports Friendly URLs via this .htaccess file. You must serve web
    # pages via Apache with mod_rewrite to use this functionality, and you must
    # change the file name from ht.access to .htaccess.
    #
    # Make sure RewriteBase points to the directory where you installed MODX.
    # E.g., "/modx" if your installation is in a "modx" subdirectory.
    #
    # You may choose to make your URLs non-case-sensitive by adding a NC directive
    # to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]

    RewriteEngine On
    RewriteBase /modx/

    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Did you enable friendly URLs in the system settings?

      Just to make life easier, I've installed a Dashboard widget to show/hide . files in the Finder http://www.apple.com/downloads/dashboard/developer/hiddenfiles.html
        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
        • 38106
        • 21 Posts
        I did.

        Quick trick: What I do with .htaccess files is first name them htaccess.txt. Open them up with TextEdit. Rename back to .htaccess using the terminal. You can now edit them with TextEdit window you have open and save them as .htaccess without having to go back and forth smiley
          • 31946
          • 116 Posts
          Hi mstank,
          I'm not sure: Try RewriteBase /modx instead of RewriteBase /modx/
          I never had this ending-slash...
            • 38106
            • 21 Posts
            I tried both. I found "The RewriteBase should end with a /" about halfway down http://rtfm.modx.com/display/revolution20/Using+Friendly+URLs
              • 38106
              • 21 Posts
              Maybe its an issue with having MAMP and localhost?
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                I've used MAMP and MODx, both Evo and more recently Revo on my localhost for years with no problems. And I've never used a trailing / on the rewriteBase.

                MODx comes with a ht.access file that only needs to have the rewriteBase line edited, and most programming editors will allow it to be saved as .htaccess. You need one in each installation's main directory.

                  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
                  • 38106
                  • 21 Posts
                  I guess I'll keep playing around smiley
                    • 31946
                    • 116 Posts
                    I think it displays the homepage because the "error_page" System Setting is set to this resource. Can you create a "Error Page" and set this setting over System > System Settings to the ID of the new resource?
                    If you see the Error Page afterwards, modx cannot find the resource for your request.
                    Does your resources have aliases? Also try clearing the modx- and browser cache.
                      • 38106
                      • 21 Posts
                      So I finally fixed it. I swear I read that the .htaccess file has to be in the directory above your modx installation. I put it in the actual modx folder, and it worked.