Converting .htaccess to web.config

Discussion in 'aMember Pro v.4' started by wattsroy, Feb 24, 2014.

  1. wattsroy

    wattsroy New Member

    Joined:
    Aug 30, 2013
    Messages:
    1
    I am trying to install aMember on a Windows server. Neither aMember of my host can help convert the aMember .htaccess file to the necessary web.config file. I'm wondering if anyone on here might be able to help?
    Here is the aMember .htaccess file that I need to convert:
    Code:
    #  Sample Nginx rules configuration:
    #  aMember rules (replace /amember to actual aMember Pro path from site root)
    #
    #      location ~* ^/amember/.*\.(js|ico|gif|jpg|png|css|swf|csv)$ {}
    #      location ~* ^/amember/setup/index.php$ { try_files not-existing-file @php; }
    #      location ~* ^/amember/js.php { try_files not-exiting-file @php; }
    #      location ~* ^/amember/index.php$ { try_files not-existing-file @php; }
    #      location ~* ^/amember/public.php$ { try_files not-existing-file @php; }
    #
    #      location ~* ^/amember/public { rewrite ^.*$ /amember/public.php; }
    #      location ~* ^/amember/setup { rewrite ^.*$ /amember/setup/index.php; }
    #      location ~* ^/amember { rewrite ^.*$ /amember/index.php; }
    #
    #  you must already have something like that in your nginx configuration:
    #
    #      location ~ \.php$ {
    #          try_files not-existing-file @php;
    #      }
    #      location @php {
    #        fastcgi_pass 127.0.0.1:9000;
    #        include fastcgi_params;
    #      }
    #
    #  it is necessary to have @php section, as it is referred by aMember rules, and
    #  it must be located at bottom
    #
    #
    <IfModule mod_rewrite.c>
        RewriteEngine on
        RewriteBase /amember
        RewriteRule ^public public.php [L]
        RewriteRule ^js.php js.php [L]
        RewriteRule !\.(js|ico|gif|jpg|png|css|swf|csv|html)$ index.php
    </IfModule>
     
    <IfModule mod_php5.c>
    #  php_flag magic_quotes_gpc off
    </IfModule>
    And here is the web.config file for the main folder. The web.config file I need is specifically for the amember folder:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
      <system.web>
        <trust level="Full"/>
    </system.web>
      <system.webServer>
        <!-- Set the default document -->
        <defaultDocument>
          <files>
            <remove value="index.php"/>
            <add value="index.php"/>
          </files>
        </defaultDocument>
        <directoryBrowse enabled="false"/>
        <rewrite>
          <rules>
                <rule name="wordpress" patternSyntax="Wildcard">
                    <match url="*"/>
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                        </conditions>
                    <action type="Rewrite" url="index.php"/>
                </rule></rules>
        </rewrite>
      </system.webServer>
    </configuration>



  2. indivault

    indivault New Member

    Joined:
    Jul 10, 2014
    Messages:
    2
    wattsroy,

    Did you have any luck with this? I would like to get aMember working on an IIS server as well.

    Thanks.
  3. indivault

    indivault New Member

    Joined:
    Jul 10, 2014
    Messages:
    2
    Welp, I think I figured it out on my own in the matter of 57 minutes, due to IIS's ability to import rules. Here's my web.config file that *seems* to be working so far:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.web>
            <trust level="Full" />
        </system.web>
        <system.webServer>
            <!-- Set the default document -->
            <defaultDocument>
                <files>
                    <remove value="index.php" />
                    <add value="index.php" />
                </files>
            </defaultDocument>
            <directoryBrowse enabled="false" />
                <rewrite>
                  <rules>
                    <remove name="WordPress Rule" />
                    <rule name="Imported Rule 1" stopProcessing="true">
                      <match url="^public" ignoreCase="false" />
                      <action type="Rewrite" url="public.php" />
                    </rule>
                    <rule name="Imported Rule 2" stopProcessing="true">
                      <match url="^js.php" ignoreCase="false" />
                      <action type="Rewrite" url="js.php" />
                    </rule>
                    <rule name="Imported Rule 3">
                      <match url="\.(js|ico|gif|jpg|png|css|swf|csv|html)$" ignoreCase="false" negate="true" />
                      <action type="Rewrite" url="index.php" />
                    </rule>
                  </rules>
                </rewrite>
        </system.webServer>
    </configuration>
  4. lsuglen

    lsuglen New Member

    Joined:
    Jan 14, 2010
    Messages:
    9
    Did you get it working fully? I copied your rules, to no avail :(

    If you got it working, can you share your secret to success?

Share This Page