> **Experimental**
>
> `@aws-cdk/aws-amplify-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# CustomRule

Custom rewrite/redirect rule for an Amplify App.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/app.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-amplify-alpha/lib/app.ts#L533)

## Example

```ts
import { CustomRule } from '@aws-cdk/aws-amplify-alpha';

declare const amplifyApp: amplify.App;
amplifyApp.addCustomRule(new CustomRule({
  source: '/docs/specific-filename.html',
  target: '/documents/different-filename.html',
  status: amplify.RedirectStatus.TEMPORARY_REDIRECT,
}));
```

## Initializer

```ts
new CustomRule(options: CustomRuleOptions)
```

## Properties

- `condition`: string — The condition for a URL rewrite or redirect rule, e.g. country code.

  **Default:** no condition

- `SINGLE_PAGE_APPLICATION_REDIRECT`: [CustomRule](/cdk/api/v2/docs/@aws-cdk_aws-amplify-alpha.CustomRule.html) (required) (static) — Sets up a 200 rewrite for all paths to `index.html` except for path containing a file extension.

- `source`: string (required) — The source pattern for a URL rewrite or redirect rule.

- `status`: [RedirectStatus](/cdk/api/v2/docs/@aws-cdk_aws-amplify-alpha.RedirectStatus.html) = PERMANENT_REDIRECT — The status code for a URL rewrite or redirect rule.

- `target`: string (required) — The target pattern for a URL rewrite or redirect rule.
