We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • For a client with an existing website I’m stuck trying to get YAMS to work with ISAPI_Rewrite V2....

    This is the .htaccess YAMS tells me to use:
    # 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 ^nl$ nl/ [R=301,L]
    
    # The Friendly URLs part
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^nl/(.*)$ index.php?q=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]


    Does anyone have any idea how to translate that into a httpd.ini?


    This code:
    [ISAPI_Rewrite]
    # 3600 = 1 hour
    CacheClockRate 3600
    
    RepeatLimit 32
    # Block external access to the httpd.ini and httpd.parse.errors files
    RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
    
    # Block external access to the Helper ISAPI Extension
    RewriteRule .*\.isrwhlp / [F,I,O]
    
    RewriteEngine On
    RewriteCond Method GET|HEAD
    
    RewriteRule /(?!(?:manager|assets)/)(.*)\.html(?:\?(.*))? /index.php?q=$1?2&$2: [I,L,U] 


    Results in the attached screenshot.
      Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

      Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
      • 4310
      • 2,310 Posts
      Here’s a copy of what I believe is a MODx ISAPI_Rewrite V2 httpd.ini file.
      Might point you in the right direction smiley
      [ISAPI_Rewrite]
      
      # 3600 = 1 hour
      CacheClockRate 3600
      
      RepeatLimit 32
      
      # Block external access to the httpd.ini and httpd.parse.errors files
      RewriteRule /httpd(?:\.ini|\.parse\.errors).* / [F,I,O]
      # Block external access to the Helper ISAPI Extension
      RewriteRule .*\.isrwhlp / [F,I,O]
      
      RewriteEngine On
      RewriteCond Method GET|HEAD 
      RewriteRule /(?!(?:manager|assets)/)(.*)\.html(?:\?(.*))? /index.php?q=$1?2&$2: [I,L,U] 
      
      

      • I was editing my post saying I tried that one right when you posted, lol.

        That code works perfect when the YAMS Plugin is disabled. When I enable the plugin, it sends out one 307 redirect (as specified in the config) and then a bunch of 301’s until Firefox cuts it off.
          Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

          Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
          • 4310
          • 2,310 Posts
          You’re missing the equivalent of these two parts :
          RewriteRule ^nl$ nl/ [R=301,L]
          RewriteRule ^nl/(.*)$ index.php?q=$1 [L,QSA]

          I don’t know how to modify the hhpd.ini to get them in. sad
          • Yeah... me neither lipsrsealed

              Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

              Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
            • Thanks to help on the Helicon Tech forum (creators of ISAPI Rewrite) I managed to get it running.

              This is the httpd.ini used on ISAPI Rewrite v2 for primary language on the root, and the second language at root/nl/:

              [ISAPI_Rewrite]
              
              # Exclude /assets and /manager directories from rewrite rules
              RewriteRule /(?:manager|assets).* $0 [I,L] 
              
              # Redirect from mydomain.com/rootname to mydomain.com/rootname/
              RewriteRule /nl http://www.piterwilkens.nl/nl/ [I,RP]
              
              # The Friendly URLs part
              RewriteRule /nl/(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
              RewriteRule /(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 22851
                • 805 Posts
                Brilliant! I guess I should build an autogenerated IIS config into the next version of YAMS now... Thanks for sharing.
                  YAMS: Yet Another Multilingual Solution for MODx
                  YAMS Forums | Latest: YAMS 1.1.9 | YAMS Documentation
                  Please consider donating if you appreciate the time and effort spent developing and supporting YAMS.
                  • 15083
                  • 697 Posts
                  Hi guys,

                  I have the very same problem with the loop.
                  Here is config, any help appreciated:

                  [ISAPI_Rewrite]
                  
                  # Exclude /assets and /manager directories from rewrite rules
                  RewriteRule /(?:manager|assets).* $0 [I,L] 
                  
                  # Redirect from mydomain.com/rootname to mydomain.com/rootname/
                  RewriteRule /ie /ie/ [I,RP]
                  RewriteRule /en /en/ [I,RP]
                  
                  # The Friendly URLs part
                  RewriteRule /ie/(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
                  RewriteRule /en/(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
                  RewriteRule /(?!(?:img|style.css|assets|manager))(.*) /index.php\?q=$1 [I,L]
                  


                  Just loops over and over....307.