We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • This will be a first time we're deploying a MODx Revo site on IIS. I dont have much information since its not our server - my company is 100% LAMP with little to know experience with IIS.

    Our SEO specialist was able to come up with a web.config file, but past that. I'm pretty stuck. I ran a getcwd to first change the file paths in /core/config/core.config it got "C:\inetpub\MobileSite" - not sure if that's what I need to update in the config files.

    The site loads (home page only). Past that, nothing will load. Manager too. Tried looking through the forums on IIS stuff, but it was a lot of nothing, no guide to really getting setup right.

    From phpinfo:
    - Windows NT COVHOUWEB02 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586
    - PHP Version 5.3.10
      Sal Baldovinos
      SEO & DIGITAL MARKETING

      ARIEL DIGITAL | Maximize Your Potential
      www.arieldigitalmarketing.com
      • 37335
      • 13 Posts
      Okay, well the first thing you need to do is make sure your paths are correct in the following files:

      • /core/config/config.inc.php
      • /connectors/config.core.php
      • /manager/config.core.php
      • /config.core.php
      per the instructions found at http://rtfm.modx.com/display/revolution20/Moving+Your+Site+to+a+New+Server

      Also check the modx_workspaces table in the database as pre-2.2 atleast saved a path in there (2.2+ just uses {core_path} I believe).

      As for the web.config, here's a basic setup for Friendly URLs (verified to work on IIS 7.5):
      <configuration>
          <system.webServer>
              <rewrite>
                  <rules>
                      <rule name="MODX Block dummy connections" stopProcessing="true">
                          <match url=".*" ignoreCase="false" />
                          <conditions logicalGrouping="MatchAll">
                              <add input="{HTTP_USER_AGENT}" pattern="^.*internal\ dummy\ connection.*$" />
                          </conditions>
                          <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
                      </rule>
                      <rule name="MODX Dont rewrite assets and manager" stopProcessing="true">
                          <match url="^(manager|assets)" ignoreCase="false" />
                          <action type="None" />
                      </rule>
                      <rule name="MODX Friendly URLs" stopProcessing="true">
                          <match url="^(.*)$" ignoreCase="false" />
                          <conditions logicalGrouping="MatchAll">
                              <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                              <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                          </conditions>
                          <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
                      </rule>
                  </rules>
              </rewrite>
          </system.webServer>
      </configuration>


      Also, do remember to clear the cache manually after editing these files, so it actually loads them.
      Hope that helps.
      • Will I need to change in the system setting in the MODx backend or leave as-is? Also, is the path I mentioned an okay path? C:\...
          Sal Baldovinos
          SEO & DIGITAL MARKETING

          ARIEL DIGITAL | Maximize Your Potential
          www.arieldigitalmarketing.com
          • 37335
          • 13 Posts
          If it's set to {core_path} then it's safe to leave as is. Otherwise it would have to be the absolute path to the core directory.

          Personally I use forward slashes in all paths, e.g. C:/directory/subdirectory/...
          Windows understands both as far as I know, I just prefer forward slashes for paths (comes from my Linux tinkering no doubt).
          • Thanks for the help! The web.config file is working now and I can at least navigate the site. There are some file permissions issues I need to work out and the forms are not submitting, but we're one step closer to being done! Thanks again.
              Sal Baldovinos
              SEO & DIGITAL MARKETING

              ARIEL DIGITAL | Maximize Your Potential
              www.arieldigitalmarketing.com
            • My next question is regarding mobile redirects. Would it be easier to us a JS method? Currently on Linux we use the htaccess file to do the detection/redirection. Do you have experience with that? This is what we use:

              #########################
              # Mobile Redirect Start #
              #########################
              
              RewriteEngine on
              RewriteBase /
              # If there is a query string of &m=0, set a cookie to direct mobile traffic to the full site, and skip the next rule
              RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
              RewriteRule ^ - [CO=mredir:0:www.URL_OF_WEBSITE.com]
               
              # Checks if the user agent is a mobile device
              RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
              RewriteCond %{HTTP:Profile}       !^$ [OR]
               
              # MOBILE DEVICES #
              # Amazon Kindle:
              RewriteCond %{HTTP_USER_AGENT}		kindle			[NC,OR]
              # Android:
              RewriteCond %{HTTP_USER_AGENT}		android.*mobile		[NC,OR]
              # Apple:
              RewriteCond %{HTTP_USER_AGENT}		iphone			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		ipod			[NC,OR]
              # Barnes & Noble Nook:
              RewriteCond %{HTTP_USER_AGENT}		nook			[NC,OR]
              # BlackBerry:
              RewriteCond %{HTTP_USER_AGENT}		blackberry		[NC,OR]
              # Palm:
              RewriteCond %{HTTP_USER_AGENT}		palm			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		pixi			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		blazer			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		eudoraweb		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		xiino			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		webos			[NC,OR]
              # Windows Mobile:
              RewriteCond %{HTTP_USER_AGENT}		"windows ce"		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		iemobile		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		"windows phone"		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		"windows mobile"	[NC,OR]
               
              # PHONE MANUFACTURERS #
              # LG phones:
              RewriteCond %{HTTP_USER_AGENT}		LG			[OR]
              # Motorola phones:
              RewriteCond %{HTTP_USER_AGENT}		^mot-			[NC,OR]
              # Nokia phones:
              RewriteCond %{HTTP_USER_AGENT}		nokia			[NC,OR]
              # Samsung SGH model phones:
              RewriteCond %{HTTP_USER_AGENT}		^SEC-SGH		[OR]
              # Sony/Ericsson:
              RewriteCond %{HTTP_USER_AGENT}		^SonyEricsson		[OR]
              # SymbianOS phones:
              RewriteCond %{HTTP_USER_AGENT}		symbian			[NC,OR]
              # Vodafone devices:
              RewriteCond %{HTTP_USER_AGENT}		vodafone		[NC,OR]
               
              # GAME CONSOLES #
              # Nintendo DS:
              RewriteCond %{HTTP_USER_AGENT}		nitro			[NC,OR]
              # Sony PSP:
              RewriteCond %{HTTP_USER_AGENT}		PSP			[OR]
               
              # MOBILE BROWSERS #
              # ARM processor:
              RewriteCond %{HTTP_USER_AGENT}		chtml			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		wap			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		midp			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		j2me			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		brew			[NC,OR]
              # Avantgo:
              RewriteCond %{HTTP_USER_AGENT}		avantgo			[NC,OR]
              # DDIPOCKET (AIR-EDGE, AirH"):
              RewriteCond %{HTTP_USER_AGENT}		ddipocket		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		^PDXGW			[OR]
              # DoCoMo:
              RewriteCond %{HTTP_USER_AGENT}		docomo			[NC,OR]
              # Maemo:
              RewriteCond %{HTTP_USER_AGENT}		maemo			[NC,OR]
              # Minimo (Firefox Mobile):
              RewriteCond %{HTTP_USER_AGENT}		minimo			[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		fennec			[NC,OR]
              # NetFront:
              RewriteCond %{HTTP_USER_AGENT}		netfront		[NC,OR]
              # Openwave UP.Browser:
              RewriteCond %{HTTP_USER_AGENT}		up\.browser		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		up\.link		[NC,OR]
              # Opera Mobile/Mini:
              RewriteCond %{HTTP_USER_AGENT}		"opera mobi"		[NC,OR]
              RewriteCond %{HTTP_USER_AGENT}		"opera mini"		[NC,OR]
              # Plucker:
              RewriteCond %{HTTP_USER_AGENT}		plucker			[NC,OR]
              # ProxiNet:
              RewriteCond %{HTTP_USER_AGENT}		ProxiNet		[OR]
              # Psion (EPOC OS):
              RewriteCond %{HTTP_USER_AGENT}		EPOC			[OR]
              # ReqwirelessWeb J2ME MIDP library:
              RewriteCond %{HTTP_USER_AGENT}		reqwirelessweb		[NC,OR]
              # Tear:
              RewriteCond %{HTTP_USER_AGENT}		tear			[NC,OR]
              # UCWEB:
              RewriteCond %{HTTP_USER_AGENT}		ucweb			[NC,OR]
              #HP (Must be at the end to negate HP's Tablet:
              RewriteCond %{HTTP_USER_AGENT}		hpwos			[NC]
              RewriteCond %{HTTP_USER_AGENT}		!tablet			[NC]
               
              # Check to see if user is already on the mobile site
              RewriteCond %{HTTP_HOST}          !^m\.
              # Can not read and write cookie in same request, must duplicate condition
              RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) 
               
              # Check to make sure we haven't set the cookie before
              RewriteCond %{HTTP_COOKIE}        !^.*mredir=0.*$ [NC]
               
              # Redirect user to the mobile site
              RewriteRule ^ http://m.URL_OF_WEBSITE.com [R=301,L]
               
              #######################
              # Mobile Redirect End #
              #######################
                Sal Baldovinos
                SEO & DIGITAL MARKETING

                ARIEL DIGITAL | Maximize Your Potential
                www.arieldigitalmarketing.com
              • For the sake of documenting my findings, here's something I came across:
                <rule name="Mobile Rewrite" patternSyntax="ECMAScript" stopProcessing="true">
                    <match url=".*" ignoreCase="true" negate="false" />
                    <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
                        <add input="{HTTP_USER_AGENT}" pattern="midp|mobile|phone" />
                        <add input="{HTTP_X-Device-User-Agent}" pattern="midp|mobile|phone" />
                        <add input="{HTTP_X-OperaMini-Phone-UA}" pattern="midp|mobile|phone" />
                    </conditions>
                    <action type="Redirect" url="http://mysite.mobi" appendQueryString="false" redirectType="Found" />
                </rule>


                It would be added to the root domain's web.config. Really good thread here: http://forums.iis.net/t/1169853.aspx [ed. note: mayhemchaos last edited this post 11 years, 7 months ago.]
                  Sal Baldovinos
                  SEO & DIGITAL MARKETING

                  ARIEL DIGITAL | Maximize Your Potential
                  www.arieldigitalmarketing.com
                  • 37335
                  • 13 Posts
                  I'm afraid I have no experience in redirecting to mobile sites. What you found seems to be able to do the trick though (a quick Google gave me the same result). I also find that htaccess method a bit on the overly-complicated side, but then again I have no experience in that area.

                  The answer found at http://serverfault.com/questions/238706/iis-7-5-redirect-url-rewrite-to-mobile-version-of-website is hinting at a way to check the cookie as well. Could be helpful.