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

    I am trying to setup a site to use two langs:
    Irish/English.
    I have setup MODx and installed YAMS (which I had to hack to get to work with 1.0.4).

    I have setup the above and got it working on a unix/a[ache system using the following .htaccess:
    # Friendly URLs
    RewriteEngine On
    RewriteBase /
    
    # Fix Apache internal dummy connections from breaking [(site_url)] cache
    RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
    RewriteRule .* - [F,L]
    
    # Exclude /assets and /manager directories from rewrite rules
    RewriteRule ^(manager|assets) - [L]
    
    # Redirect from mydomain.com/rootname to mydomain.com/rootname/
    RewriteRule ^en$ en/ [R=301,L]
    RewriteRule ^ie$ ie/ [R=301,L]
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^en/(.*)$ index.php?q=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ie/(.*)$ index.php?q=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    


    I have pasted the above into the Helicon tab in iis. I get no errors, so I assume its working.
    When I enable furls, I just get page cannot be found.
    Can anyone help out here?

    Thanks in advance...

    J
      • 15083
      • 697 Posts
      Current Code looks like this:

      # Helicon ISAPI_Rewrite configuration file
      # Version 3.1.0.79
      
      # Friendly URLs
      RewriteEngine On
      RewriteBase /
      
      # Fix Apache internal dummy connections from breaking [(site_url)] cache
      RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
      RewriteRule .* - [F,L]
      
      # Exclude /assets and /manager directories from rewrite rules
      RewriteRule ^(manager|assets) - [L]
      
      # Redirect from mydomain.com/rootname to mydomain.com/rootname/
      RewriteRule ^en$ en/ [R=301,L]
      RewriteRule ^ie$ ie/ [R=301,L]
      
      # The Friendly URLs part
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^en/(.*)$ /index.php?q=$1 [L,QSA]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^ie/(.*)$ /index.php?q=$1 [L,QSA]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]
      


      With furls on I get the following:
      If I hit the root I get an endless lop of 307 redirects.
      EG:
      GET /index.html 307
      GET /en/index.html 307
      GET /en/index.html 307
      etc etc etc......

      I guess i’m missing something from the config file?
        • 15083
        • 697 Posts
        Hi guys....

        Still banging my head off the IIS FAIL wall with this one.
        I can get normal bog standard url rewritting working fine, but when I turn on YAMS I end up in an infinte 307 redirect loop.
        Current code:

        # Helicon ISAPI_Rewrite configuration file
        # Version 3.1.0.79
        
        RewriteEngine On
        RewriteCompatibility2 On
        RepeatLimit 32
        RewriteBase 
        
        # Exclude /assets and /manager directories from rewrite rules
        RewriteRule /(?:manager|assets).* $0 [I,L] 
        
        # Redirect from mydomain.com/rootname to mydomain.com/rootname/
        
        # The Friendly URLs part
        RewriteRule /ie/(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
        RewriteRule /(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
        


        I thought this rule: RewriteRule /ie/(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
        would catch any http://mydomain.com/ie/blah.html, and send it to /index.php?q=blah.html
        But this causes the endless loop?
          • 15083
          • 697 Posts
          I have Helicon engineers looking into this, and will post the working config file, if we do indeed find one!

          I think there may be something going on with YAMS, as I can get the re-write component doing everything BUT working with the YAMS url structure.
            • 15083
            • 697 Posts
            Update on this guys, Helicon got it fixed.
            Here is the HT access file in use:
            # 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
            
            # Friendly URLs
            RewriteEngine On
            RewriteBase /
            
            # Fix Apache internal dummy connections from breaking [(site_url)] cache
            RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
            RewriteRule .* - [F,L]
            
            # Exclude /assets and /manager directories from rewrite rules
            RewriteRule ^(manager|assets) - [L]
            
            # Redirect from mydomain.com/rootname to mydomain.com/rootname/
            RewriteRule ^en$ en/ [R=301,L]
            RewriteRule ^ie$ ie/ [R=301,L]
            
            # The Friendly URLs part
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^en/(.*)$ index.php?q=$1 [L,QSA]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^ie/(.*)$ index.php?q=$1 [L,QSA]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
            php_value zlib.output_compression_level 5
            


            You need to open you index.php file. At the top of the file add the following code:
            if (isset($_SERVER[’HTTP_X_REWRITE_URL’]))
            {
            $_SERVER[’REQUEST_URI’] = $_SERVER[’HTTP_X_REWRITE_URL’];
            }

            That will get you working!