We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14214
    • 299 Posts
    I needed to add a script and related files to my site outside of MODx. I uploaded the directory to my server and visited the appropriate URL only to get a error 404. Attempted different directory and even added the directory to the .htaccess file next to manager and assets. No dice. Running 1.0.12 on Centos VPS on AWS EC2.

    Any advice or solutions? Under the gun to get this solved as I thought it would be a quick one.

    Thanks in advance.
      • 14214
      • 299 Posts
      Okay, noticing that I am due to upgrade I uploaded 1.0.13 and went to install. Got a error 404. Renamed .htaccess and tried to visit the installer and got a default server 404 page. So I am thinking maybe it is an issue with my .htaccess file.


      What to do?
        • 14214
        • 299 Posts
        Tried the default .htaccess file and no dice there either.
          • 14214
          • 299 Posts
          Any help here? This is fairly significant of an issue...
            • 10208 ☆ A M B ☆
            • 1,780 Posts
            This sounds like something your host should be helping you with. Files and .htaccess writes outside of MODX aren't something those around here specialize in normally.
              Frogabog- MODX Websites in Portland Oregon
              "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
              Having server issues? These guys have MODX Hosting perfected - SkyToaster
              • 14214
              • 299 Posts
              Well the files are within the same directory as MODx just a level down. Why would MODx take over for files that actually exist?
                • 13428 ☆ A M B ☆
                • 1,031 Posts
                How do you call that files? Do you have an example?

                The default .htaccess of MODX should avoid the rewrite/redirect of files that physical exist as file on the webserver. If you have a subfolder in the webroot that should not be worked from MODX .htaccess you could exclude that folder in the lines:

                # Exclude /assets and /manager directories and images from rewrite rules
                RewriteRule ^(manager|assets)/.*$ - [L]

                  • 14214
                  • 299 Posts
                  The strange thing is that I first put the files within the assets directory, then added them in a different directory and same result.
                    • 14214
                    • 299 Posts
                    Here is my current .htaccess file

                    #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 \.(jpg|jpeg|png|gif|ico)$ - [L]
                    RewriteRule ^(manager|assets)/.*$ - [L]
                    
                    
                    #Gzip
                    <ifmodule mod_deflate.c>
                    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
                    </ifmodule>
                    #End Gzip
                    
                    # 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
                    
                    ExpiresActive On
                    ExpiresDefault "access plus 10 days”
                    ExpiresByType text/html "access plus 1 day"
                    


                    When I remove my .htaccess file I get the system error 404.

                    I am running Cpanel and have another account on the same server. I attempted to run the installer on another MODx site on the other account, same server, and received the site's error 404. Removed the .htaccess file and received the system default 404. My server admin thought it was something related to MODx since it seems to "rule" the directory. Any thoughts on where to look?
                      • 13428 ☆ A M B ☆
                      • 1,031 Posts
                      Do the files you try to access on your webserver have sufficient rights to be read (folders have to be executable) by Apache?

                      There should not be anything disturbing direct folder/file access beside the assets/cache folder (inside there is a deny from all setting created during installation).