We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 241
    • 8 Posts
    aaronganderson Reply #1, 17 years ago
    I see many other posts on this subject and I really have read through a lot of them, but I really am stuck. I’ve been developing my MODX site on GoDaddy where Friendly URLs seem to work, but in switching to a different hosting provider for the live site, they now no longer work.
    - I already got the second hosting provider to enable options and mod_rewrite in Apache
    - My site is deployed to the base directory, so I don’t need to adjust the path that’s being rewritten or the basepath
    - I’ve got my ZLIB’s commented out
    - I’ve turned on friendly URL’s under Configuration > Friendly URL’s
    - I know my .htaccess file is being invoked because it was blowing up previous to me getting the hosting company to fix the apache conf (see first bullet)

    Just so I’m clear, when I say "doesn’t work", I mean that going to anything other than index.php?id=<page id> bounces me to the home page.

    The thing that’s really suspicious to me is that the mod_rewrite simply redirects inbound traffic which does not resolve to a file or directory and passes it back into Modx as "index.php?q=<failed resource request>". So, theoretically, if I rename my .htaccess file back to ht.access and leave Friendly URLs on with an suffix of .html, then calling index.php?id=10 *should* be the same as index.php?q=10.html (which is what Apache would create from a request to 10.html) - yet, index.php?q=10.html simply bounces me back to the homepage. Its almost like Modx is ignoring the q parameter.

    Any ideas on what I might be missing or misunderstanding?

    BTW - I’m running Modx version 1.0.

    Thanks for any help and thanks to the Modx team for a great product - despite this hiccup, its saved me a lot of time.

    - Aaron Anderson
    [email protected]
      • 37550 ☆ A M B ☆
      • 711 Posts
      onesmarthost Reply #2, 17 years ago
      Hi,

      MOD Rewrite should only be passing over the page alias name when it transforms the URL and it should be stripping the .html extension:

      i.e. http://www.onesmarthost.co.uk/index.php?q=Web-Hosting

      or MODx can work by the page ID i.e. http://www.onesmarthost.co.uk/index.php?q=1

      Check if the above work for you first so find what one of your pages ID is and document alias, if the above works then we know that MODx is working fine.

      Also it is hard to say if your mod rewrite rules are working, because you might have custom error pages 404 set to redirect to /index.php if you could turn this off then try to access a page with friendly URL’s it should redirect to index.php or the page you intended if it does not redirect and you get a default server 404 then it would mean your rules / mod rewrite is not working.

      Feel free to post the contents of your .htaccess here so we can check for errors.

      Thanks Aaron


        http://www.onesmarthost.co.uk
        UK MODX Hosting with love.
        • 241
        • 8 Posts
        aaronganderson Reply #3, 17 years ago
        With friendly URL’s turned on and my .htaccess file named ht.access (so it shouldn’t be getting invoked), if I try either index.php?q=<alias or resource id> I get bounced to my homepage. Seems weird.

        My .htaccess file (which should be only modified to add in the NC parameter):

        # 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

        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} !^example\.com [NC]
        #RewriteRule (.*) http://example.com/$1 [R=301,L]

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

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

        # Reduce server overhead by enabling output compression if supported.
        #php_flag zlib.output_compression On
        #php_value zlib.output_compression_level 5

        Thanks - Other Aaron
          • 37550 ☆ A M B ☆
          • 711 Posts
          onesmarthost Reply #4, 17 years ago
          What happens when you try

          www.yourdomain.com/index.php?q=documentalias (like in my example above)

          and also www.yourdomain.com/index.php?q=2 (2 being a page ID)

          Also do you have custom errors setup on your website for 404 messages to go to /index.php ?



            http://www.onesmarthost.co.uk
            UK MODX Hosting with love.