Skip to content

web.config rewrite rules #80

Closed
ParHaggstrom opened this Issue Oct 10, 2012 · 4 comments

3 participants

@ParHaggstrom

Hi

I'm trying to get this to work on a Windows server and cant seem to find an example of a typical rewrite rule for a web.config file.

Is there any such file?

Anything else thats needs concideration when applying Adaptive-Images to Windows and not a Unix environment?

Thanks. Pär

@MattWilcox
Owner

Hi there :)

I'm afraid I can't help you with this as I have never used Windows as a server :s If you're using Apache+PHP it should still be fine, but if you're using some other webserver, like IIS, you'll need to see what equivalents it has to Apache's .htaccess. I'm sure it's doable, I just don't know how.

-Matt

@ParHaggstrom

Oh thanks anyway, and thanks for the quick reply.

I'll give it a try, If I get it to work I'll post the solution.

@ParHaggstrom

Hi again.

After some troubleshooting. Here's my rewrite rules I have for my Wordpress installation copy/pasted.

<configuration>
    <system.web>
        <compilation debug="false" targetFramework="4.0"/>
    </system.web>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="images">
                    <match url="\.(?:jpe?g|gif|png)$" />
                    <conditions>
                        <add input="{URL}" pattern="^\/wp-content\/uploads\/" />
                    </conditions>
                    <action type="Rewrite" url="/adaptive-images.php" />
                </rule>
                <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>

This sure is a great plugin. Great work and thanks Matt

@angiethings

Hi
is it possible to add watermarks to images already in a web directory using this kind of method in web.config,, thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.