Converting IIS Redirect to .htaccess

Posted by user1641321 on Stack Overflow See other posts from Stack Overflow or by user1641321
Published on 2012-09-02T03:32:28Z Indexed on 2012/09/02 3:37 UTC
Read the original article Hit count: 167

I am having trouble getting the rewrite to work on an apache server. The end result is so i can make subdomains on the fly just by adding a directory. For example anysubdomain.domain.com will redirect to domain.com/anysubdomain and still appear as anysubdomain.domain.com.

Is there anyone out there that convert this for me?

<rewrite>
        <rules>
            <rule name="Subdomain Redirect" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="^(.*)$" />
                <conditions trackAllCaptures="true">
                    <add input="{HTTP_HOST}" pattern="^www\.obdevsite\.com" negate="true" />
                    <add input="{HTTP_HOST}" pattern="^(.*)\.obdevsite\.com" />
                    <add input="{REQUEST_URI}" pattern="^(.*)$" />
                </conditions>
                <action type="Rewrite" url="/{C:1}/{C:2}" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>

© Stack Overflow or respective owner

Related posts about .htaccess

Related posts about mod-rewrite