Skip to content

Latest commit

 

History

History
63 lines (55 loc) · 1.91 KB

README.md

File metadata and controls

63 lines (55 loc) · 1.91 KB

Amazon S3 Routing Rules Builder

Inspired by Netlify's redirect syntax, build S3 conditional routing rules using a simple space separated syntax.

Usage

Visit the project Demo site and paste your redirect rules in the text editor. Here is an example below:

/home              /
/blog/my-post.php  /blog/my-post  301
/news              /blog          200
/google            https://www.google.com

This will be transformed into the following:

<RoutingRules>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>/home</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <ReplaceKeyPrefixWith>/</ReplaceKeyPrefixWith>
        </Redirect>
    </RoutingRule>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>/blog/my-post.php</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <ReplaceKeyWith>/blog/my-post</ReplaceKeyWith>
            <HttpRedirectCode>301</HttpRedirectCode>
        </Redirect>
    </RoutingRule>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>/news</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <ReplaceKeyWith>/blog</ReplaceKeyWith>
            <HttpRedirectCode>200</HttpRedirectCode>
        </Redirect>
    </RoutingRule>
    <RoutingRule>
        <Condition>
            <KeyPrefixEquals>/google</KeyPrefixEquals>
        </Condition>
        <Redirect>
            <Protocol>https</Protocol>
            <HostName>www.google.com</HostName>
        </Redirect>
    </RoutingRule>
</RoutingRules>

Built With