# Rewrite

This section contains rewrite rules (implementing `IRule`) and extensions for `RewriteOptions` that could help in managing request routings and redirects.

| Rule name                            | Description                                                                                                                        | Example                                                                                             |
| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| RedirectToLowercaseRule              | Rule performing redirect for GET requests to lower case url in case any upper characters are present                               | <http://localhost:5001/Home/Index> => <http://localhost:5001/home/index>                            |
| RedirectToTrailingSlashRule          | Rule performing redirect for GET requests by adding a trailing slash.                                                              | <http://localhost:5001/Home/Index?search=hello> => <http://localhost:5001/Home/Index/?search=hello> |
| RedirectToLowercaseTrailingSlashRule | Rule performing redirect for GET requests to lower case url in case any upper characters are present, while adding trailing slash. | <http://localhost:5001/Home/Index?search=hello> => <http://localhost:5001/home/index/?search=hello> |

Corresponding extensions are:

| Method name                         | Return type      | Description                                                                                                                                               |
| ----------------------------------- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AddRedirectToLowercase              | `RewriteOptions` | Defines rule performing redirect with status 301 for GET requests to lower case url in case any upper characters are present.                             |
| AddRedirectToTrailingSlash          | `RewriteOptions` | Define rule performing redirect with status 301 for GET requests by adding a trailing slash.                                                              |
| AddRedirectToLowercaseTrailingSlash | `RewriteOptions` | Define rule performing redirect with status 301 for GET requests to lower case url in case any upper characters are present, while adding trailing slash. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.structr.dev/presentation/aspnetcore/rewrite.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
