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

    I would really like someone's help with this issue. I have finally completed the top page and its two duplicate pages under the top page in the Resource tree to develop new pages from. However, each time I turn on Friendly URL on the Configuration tab, navigating to the duplicate pages from the preview of the top page returns 404 error. When it is disabled, the two duplicate pages show up fine under the /index/ folder shown in the web address bar.

    Could anyone please help me find a solution? I have to show the website in interviews tomorrow and time is pressing on me.

    Best regards,

    Ead
    • Have you renamed the ht.access file in your web root directory to .htaccess?
        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
        • 44537
        • 13 Posts
        Renaming ht.access .htaccess has worked! I noticed the manager folder too has a file named ht.access so I changed this one as well, but what might this be doing..?
        • This .htaccess file has the rewrite rules for rewriting your page URLs, such as "page.html", to the main index.php file (index.php?q=page.html) so that MODx gets started and can go find the resource with the alias "page" and process it.

          # For Friendly URLs
          RewriteCond %{REQUEST_FILENAME} !-f 
          (if it can't find a file)
          RewriteCond %{REQUEST_FILENAME} !-d 
          (if it can't find a directory)
          RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] 
          (re-write it so MODx can get it)
          


          While you want all requests for site pages to be re-written to index.php?q=page, you don't want any of the manager pages rewritten like that. So the .htaccess file in the /manager/ directory simply turns off the rewrite engine for the /manager/ directory and all of its children. You don't really need it, since the main .htaccess file excludes it, along with a bunch of other stuff you don't want rewritten.
          # Exclude /assets and /manager directories and images from rewrite rules
          RewriteRule ^(manager|assets|js|css|images|img)/.*$ - [L] 
          (L means stop rewriting stuff for this request here)
          RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L] 
          (L means stop rewriting stuff for this request here)
          
          [ed. note: sottwell last edited this post 10 years, 8 months ago.]
            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
            • 44537
            • 13 Posts
            Makes sense, thanks. I feel reasonably confident with Evolution now, so I might give Revolution a try.
            • On the surface, Revo works pretty much like Evo. It's what's under the hood that makes the difference.
                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
                • 44537
                • 13 Posts
                The problem has come back after a few hours although the web server shows .htaccess under the web directory and ht.access under the manager directory... Is there something else you would do to solve it once and for all?

                The below is the content of the .htaccess file under the web directory:

                # For full documentation and other suggested options, please see
                # http://svn.modxcms.com/docs/display/MODx096/Friendly+URL+Solutions
                # including for unexpected logouts in multi-server/cloud environments
                # and especially for the first three commented out rules

                #php_flag register_globals Off
                #AddDefaultCharset utf-8
                #php_value date.timezone Europe/Moscow

                Options +FollowSymlinks
                RewriteEngine On
                RewriteBase /

                # Fix Apache internal dummy connections from breaking [(site_url)] cache
                RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
                RewriteRule .* - [F,L]

                # Rewrite domain.com -> www.domain.com -- used with SEO Strict URLs plugin
                #RewriteCond %{HTTP_HOST} .
                #RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
                #RewriteRule (.*) http://www.example.com/$1 [R=301,L]

                # Exclude /assets and /manager directories and images from rewrite rules
                RewriteRule ^(manager|assets)/*$ - [L]
                RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L]

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

                # Reduce server overhead by enabling output compression if supported.
                #php_flag zlib.output_compression On
                #php_value zlib.output_compression_level 5 [ed. note: eadwig last edited this post 10 years, 8 months ago.]
                • Did you change anything in the time between when the URLs worked and now?
                    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
                    • 44537
                    • 13 Posts
                    The only change I have made was to insert a few lines to define the a:visited property into the css file and uploaded it, so I just cannot begin thinking what could have brought down those pages, but then again it may be the web server which has been giving me trouble all along..

                    Just now I have removed the .htaccess under the web directory and copied the original ht.access and renamed it .htaccess under the same directory to no avail..
                      • 44537
                      • 13 Posts
                      Sorry I must have been blind - those two pages had not been published. Now they are published, they appear alright in any browser.

                      The thing I still don't understand is they did appear several hours ago without clicking the preview button...