Link to home
Start Free TrialLog in
Avatar of rpajak1
rpajak1Flag for United States of America

asked on

need help Converting web.config to .htaccess

Hello everyone...

I need help converting my web.config file into a .htaccess file.

I hope we can find some volenteers...

Here is contents of the web.config file....
Please help....

..DA for R
-------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <outboundRules>
                <clear />
                <rule name="www.bananapages.net virtual path rewrite">
                    <match serverVariable="RESPONSE_LOCATION" pattern="^(https?\://www\.bananapages\.net)/bp/(.+/)$" />
                    <conditions>
                        <add input="{RESPONSE_STATUS}" pattern="^301$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" value="{R:1}/{R:2}" />
                </rule>
                <rule name="bananapages.net virtual path rewrite">
                    <match serverVariable="RESPONSE_LOCATION" pattern="^(https?\://bananapages\.net)/bp/(.+/)$" />
                    <conditions>
                        <add input="{RESPONSE_STATUS}" pattern="^301$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" value="{R:1}/{R:2}" />
                </rule>
                <rule name="Rewrite" preCondition="IsHTML" enabled="true" patternSyntax="Wildcard">
                    <match filterByTags="A, Area, Img, Input, Link, Script" pattern="*/blog/*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
                    <action type="Rewrite" value="{R:1}/{R:2}" />
                </rule>
                <rule name="rewrite2" preCondition="IsHTML" enabled="true" patternSyntax="Wildcard">
                    <match filterByTags="A, Script" pattern="*%2fblog*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
                    <action type="Rewrite" value="{R:1}{R:2}" />
                </rule>
            <rule name="Rewritebp1" preCondition="IsHTML" enabled="true" patternSyntax="Wildcard">
                    <match filterByTags="A, Area, Base, Form, Img, Input, Link, Script" pattern="*/bp/*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
                    <action type="Rewrite" value="{R:1}/{R:2}" />
                </rule>
                <rule name="rewritebp2" preCondition="IsHTML" enabled="true" patternSyntax="Wildcard">
                    <match filterByTags="A, Script" pattern="*%2fbp*" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
                    <action type="Rewrite" value="{R:1}{R:2}" />
                </rule>
                <rule name="Rewrite3" preCondition="IsHTML" enabled="true" patternSyntax="Wildcard">
                    <match filterByTags="CustomTags" customTags="javascripts" pattern="*/blog/*" />
                    <action type="Rewrite" value="{R:1}/{R:2}" />
                </rule>
                <rule name="Rewrite Location Header" preCondition="IsRedirection" patternSyntax="Wildcard">
                    <match serverVariable="RESPONSE_Location" pattern="*/blog/*" />
                    <action type="Rewrite" value="{R:1}/{R:2}" />
                </rule>
                <preConditions>
                    <preCondition name="IsHTML" patternSyntax="Wildcard">
                        <add input="{RESPONSE_CONTENT_TYPE}" pattern="*text/html*" />
                    </preCondition>
                    <preCondition name="IsRedirection" patternSyntax="Wildcard">
                        <add input="{RESPONSE_STATUS}" pattern="302" />
                    </preCondition>
                </preConditions>
                <customTags>
                    <tags name="javascripts">
                        <tag name="input" attribute="onkeypress" />
                        <tag name="input" attribute="onclick" />
                  
                </tags>
                </customTags>
            </outboundRules>
            <rules>
                <rule platformId="wdpVpr" name="www.bananapages.net virtual path rewrite" stopProcessing="true">
                    <match url="^.*$" ignoreCase="false" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.bananapages\.net$" />
                    </conditions>
                    <action type="Rewrite" url="/bp/{R:0}" appendQueryString="true" />
                </rule>
                <rule platformId="wdpVpr" name="bananapages.net virtual path rewrite" stopProcessing="true">
                    <match url="^.*$" ignoreCase="false" />
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^bananapages\.net$" />
                    </conditions>
                    <action type="Rewrite" url="/bp/{R:0}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
        <urlCompression doStaticCompression="false" />
    </system.webServer>
</configuration>
Avatar of skullnobrains
skullnobrains

RewriteEngine On
RewriteRule https?\://www\.bananapages\.net)/bp/(.+/)$ $1/$2
RewriteRule https?\://bananapages\.net)/bp/(.+/)$ $1/$2
would take care of the first 2

i don't know of an equivalent for "match filterByTags" in apache nor does it feature ways to add headers in this way (but the added http_host headers don't seem very useful)

could you describe the functionalities you want rather than trying to convert file formats for software with little in common feature-wise ?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why did you present a "C" grade?