Jump to content

URL Friendly For Windows Server? .htaccess file


AL Master

Recommended Posts

Posted

Hello,

 

I just cannot  use URL Friendly...on Windows Server,, because i can't find .htaccess file to convert it to web Config

 

Can someone give me the .htaccess, so I can convert it and enable the URL Friendly...

 

Regards

Posted

Well, i have extensively used windows server 2012 + IIS 8.5 for hosting IPB and i'll tell you something first:

 

- IPB was not designed to be served in IIS. It's difficult to get the Furls working, IPS side there is no windows server support. Being so, if you are not proeficient in regex (i am not, too..) you will find very difficult to tune it to FURL. I have been trying for about one year, and i could do it.

- You will run into encoding issues as windows server "prefers" to encode in Windows-1252 which is translatable to UTF8Mb4 (4 bytes to represent characters). Guess what? Till IPB 4.0, you cannot use UTF8MB4, as the IPS encoding method does not support it, and PHP in windows does not correctly receive the Locale information. So there are characters virtually impossible to use unless you make some deep editing of IPB source files (which i did to enable the € character, for example). As far as i know IPB 4.0 will support utf8MB4 but i have not tried it yet.

- I do prefer windows for working, but i was able to migrate from Windows to linux in less than one week and i had never done it before nor used linux for hosting. My dedicated windows server had 32GB ram, SSD disk, 16 core CPU and i migrated to a much cheaper centOS alternative with 8GB Ram, SSD disk and 8 core CPU and i could see performance gains using NGINX. My board has about 27K users and almos a million posts, with lots of 3rd party apps.

 

Having said this, i can give you the source for web.config i was using at my first attempt to get FURLs:

 

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors errorMode="DetailedLocalOnly" existingResponse="Auto">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" responseMode="File" />
        </httpErrors>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="\.(jpeg|jpg|gif|png)$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/public/404.php" />
                </rule>
                <rule name="Imported Rule 2" 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" />
                </rule>
                <rule name="WWWless" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^(www\.)(.*)$" />
                    </conditions>
                    <action type="Redirect" url="http://forumusica.com{PATH_INFO}" />
                </rule>
                <rule name="IP Canonicalization (IP Hit)" enabled="false" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="HTTP_HOST" pattern="144.76.117.172" />
                    </conditions>
                    <action type="Redirect" url="http://forumusica.com" />
                </rule>
                <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
                    <match url="^index\.php$" />
                    <conditions>
                        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
                        <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)$" />
                    </conditions>
                    <action type="Redirect" url="{C:1}" appendQueryString="false" />
                </rule>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <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?{R:1}" />
                </rule>
            </rules>
        </rewrite>
        <httpRedirect enabled="false" httpResponseStatus="Permanent" />
        <urlCompression doDynamicCompression="false" />
        <caching>
            <profiles>
                <add extension=".css" policy="DontCache" kernelCachePolicy="CacheUntilChange" />
                <add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" />
                <add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" />
            </profiles>
        </caching>
    </system.webServer>
    <system.web>
        <customErrors mode="Off" />
    </system.web>
</configuration>

Do not forget to change the forumusica.com to your address :)

The second way (more direct and you can even use the .htaccess file directly - at the cost of speed) is the use of the Helicon APE extension for IIS. Basically, it enables the use of the .htaccess for you site. I has a downside: it increases response time (despite Helicon saying it's fast). Nevertheless i ended up using it to obtain the best FURL and IPContent working.

  • 3 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...