We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39142
    • 3 Posts
    I installed Revolution 2.2.0-pl2 on an EC2 instance running an Ubuntu image. I activated the rewrite module. I enabled mod_rewrite in a .htaccess file and added:

    <IfModule mod_rewrite.c>
    
      Options +FollowSymlinks
      RewriteEngine On
      RewriteBase /
    
    # Block access to "hidden" directories whose names begin with a period. This
    # includes directories used by version control systems such as Subversion or Git.
    
      RewriteCond %{SCRIPT_FILENAME} -d
      RewriteCond %{SCRIPT_FILENAME} -f
      RewriteRule "(^|/)\." - [F]
     
    # Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
    # sample file has ?q=$1 but that doesn't work
      RewriteRule ^(.*)$ index.php?id=$1 [L,QSA]
    
    # Rewrite "www.example.com -> example.com"
      RewriteCond %{HTTPS} !=on
      RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
      RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
    
    </IfModule>
    


    I have also tried a file that consisted only of:

      Options +FollowSymlinks
      RewriteEngine On
      RewriteBase /
    
     
    # Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?id=$1 [L,QSA]
    
    


    And I have tried using `q` rather than `id`. In all cases, I get a 404 page.

    The resource with id 4 is published with the alias "test-page" and clicking "view" loads
    http://example.com/test-page.html in the address bar, as you would expect, but the page is 404.

    Likewise, if I go to http://example.com/index.php?id=4 I am redirected to http://example.com/test-page.html and a 404 "The requested URL /test-page.html was not found on this server."

    The `Use Friendly Urls` option is set to "yes". But always, I get a 404. I have used Modx Revolution in the past without difficulties and as far as I can tell, I haven't done anything differently this time, yet something is wrong.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Are you sure mod_rewrite is enabled on the server?

      Is the site installed in the web root, or in a subdirectory?
        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
        • 39142
        • 3 Posts
        Yes, mod_rewrite is loaded ... which means I'm an idiot and forgot to add the AllowOverride directive <https://httpd.apache.org/docs/2.3/mod/core.html#allowoverride>

        oops.

        fixed now, thanks!
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Heh. It's usually the simple things wink
            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