We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Oops i re read my post i meant it doesnt work when enabled.

    I wonder if it has anything to do with this

    $myProtocol = ($_SERVER[’HTTPS’] == ’on’) ? ’https’ : ’http’;
    $s = $_SERVER[’REQUEST_URI’];
    $parts = explode("?", $s);

    I will try it shortly on an IIS site which has https

      http://www.onesmarthost.co.uk
      UK MODX Hosting with love.
      • 20751
      • 122 Posts
      Thanks Aaron . . . just shooting in the dark here but I commented out the parts of the script that do the redirecting using 301 header redirects. I enabled the plugin and I can see all of my search engine friendly pages now whereas before I couldn’t. The script is also successfully re-writing urls for folders and the site start page.

      Of course now though it doesn’t redirect any place becuase I’ve commented those bits out.

      All this leads me to think that it’s a redirection issue. If you google "Header 301 redirect IIS" there are a few sites that mention a bug in php with header 301 redirects using IIS but it seems to be a rather old bug.

      Doing more research now. . . l’m pretty sure it’s getting the $parts array right if it’s managing to rewrite urls its just the redirect I reckon it’s having problems with. Let me know what you find! We might crack this yet!

      grin
      • Sounds good,

        I’m also thinking perhaps this plugin is not needed if MODx can render the links without .html ISAPI_Rewrite should be able to rewrite and force strict SEO URLs.

        I will let you know what I find.

        Thanks
          http://www.onesmarthost.co.uk
          UK MODX Hosting with love.
          • 13993
          • 100 Posts
          I’m sure ASAPI can do much of it, but how scalable is that solution. Can ASAPI tell the difference between a container and a page or if the page should have an extension of .css instead of .html?

          I know there are some others on the board running this plugin on windows. If you take a look at the main plugin support thread you’ll see some issues they have been having but overall it seems to work. I have no experience with IIS though so maybe Appoxx has an idea on how to fix it.
            • 4310
            • 2,310 Posts
            Carrying on from some help Aaron (awardle) gave me with ISAPI Rewrite, here is my less than perfect solution for SEO Stricter URL’s on IIS :

            The idea is to stop search engines potentially indexing multiple ways of accessing of the same page by creating a permanent 301 redirect.

            For example, 8 ways of accessing one page:

            [tt]yourdomain.com/test.html
            yourdomain.com/index.php?id=24
            yourdomain.com/test
            yourdomain.com/test/
            www.yourdomain.com/test.html
            www.yourdomain.com/index.php?id=24
            www.yourdomain.com/test
            www.yourdomain.com/test/[/tt]

            Some of the examples are not likely to be an issue, but some could be.

            Friendly URL’s should be enabled in the Manager and I’ve assumed you’ve used the .html suffix.

            Assuming you have ISAPI Rewrite 2 from http://www.helicontech.com/ ( I don’t know if this would work with the Lite version?)

            You need to create a file named httpd.ini in the root of your site.

            The first part of the file should contain:
            [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] 


            To force yourdomain.com => www.yourdomain.com => www.yourdomain.com/index.html and
            www.yourdomain.com/index.php?id=1 => www.yourdomain.com/index.html add this:

            RewriteCond Host: yourdomain.com
            RewriteRule (.*) http://www.yourdomain.com$1 [I,RP] 
            RewriteRule (.*)/index.html http://www.yourdomain.com/ [I,RP]
            RewriteRule /index\.php\?id\=1 /index.html [I,RP]


            For other pages I add more rules:

            RewriteRule /anot(.*) /another-page.html [I,RP]
            RewriteRule /index\.php\?id\=51 /another-page.html [I,RP]


            By using the first few letters of the page name i.e. anot rather than the full name it helps catch any bad spelling.
            Just ensure you use enough letters to make the page unique, or otherwise you could redirect several pages to one!

            Repeat for each page you want to redirect.

            Probably not the most elegant solution, but it seems to work.

            Good luck!

            David