Configures URL rewriting and redirects in Orchard Core. Covers redirect vs rewrite rules, regex patterns, Apache mod_rewrite flags, admin path exclusion, rule ordering, custom rule sources, and the UrlRewriting recipe step.
Ships in orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate URL rewrite rules, redirect configurations, and custom rule sources for Orchard Core.
OrchardCore.UrlRewriting for URL rewrite and redirect support. Manage rules under Tools > URL Rewriting; this requires the ManageUrlRewritingRules permission (OrchardCore.UrlRewriting.UrlRewritingPermissions.ManageUrlRewritingRules).Order (then creation date). Each rule is translated to an ASP.NET Core Apache mod_rewrite rule (RewriteRule pattern substitution [NC,QSA|QSD,R=301])./Admin by default) are always excluded, so a bad rule cannot lock you out of the admin.^ and $ for exact matches.$1, $2, etc. in substitution patterns to reference regex capture groups.IsCaseInsensitive to true for case-insensitive pattern matching.QueryStringPolicy to Append (keep query strings) or Drop (discard them).IUrlRewriteRuleSource and are registered with services.AddRewriteRuleSource<T>().AdminList shape and stays drag-sortable in both the List and Grid layouts: the view sets rows-* attributes on the <admin-list> tag (RowsAttributes: rows-id is the sortable container id UrlRewritingAdminList.SortableContainerId, rows-data-sort-url the sort endpoint) so each row, a subgrid in the Grid layout, has its own box to drag. A sort is saved immediately through the module's sort endpoint.UrlRewriting recipe step) requires a non-empty Pattern and SubstitutionPattern that the ASP.NET Core mod_rewrite parser accepts: Pattern is checked as RewriteRule {Pattern} - and SubstitutionPattern as RewriteRule ^ {SubstitutionPattern}. A substitution is not a regular expression: /products/$1 and https://%{HTTP_HOST}/new-page are valid, but a trailing $ or % (/new-page$, /new-page%) is rejected, as is a pattern with a space (^/old page$) or an unbalanced group.Unable to configure the URL rewriting rule '{RuleName}'); it no longer prevents the other rules, or the tenant, from working.{
"steps": [
{
"name": "Feature",
"enable": [
"OrchardCore.UrlRewriting"
],
"disable": []
}
]
}
| Rule Type | Description | Use Case |
|---|---|---|
| Redirect Rule | Sends an HTTP redirect response (301/302/307/308) to the client. The browser URL changes. | URL migrations, domain changes, SEO canonical URLs. |
| Rewrite Rule | Modifies the request URL server-side. The browser URL stays the same. | URL aliasing, serving content from different paths. |
| Property | Description |
|---|---|
Id | Unique identifier. Leave empty to create new; match existing ID to update. |
Name | Descriptive name for the rule. |
Pattern | Regex pattern to match against the request URL. |
SubstitutionPattern | Target URL for the redirect. Supports $1, $2 capture groups. |
IsCaseInsensitive | When true, pattern matching ignores case. |
QueryStringPolicy | Append keeps original query string; Drop discards it. |
RedirectType | MovedPermanently (301), Found (302), TemporaryRedirect (307), or PermanentRedirect (308). |
| Property | Description |
|---|---|
Id | Unique identifier. Leave empty to create new; match existing ID to update. |
Name | Descriptive name for the rule. |
Pattern | Regex pattern to match against the request URL. |
SubstitutionPattern | Target URL for the rewrite. Supports $1, $2 capture groups. |
IsCaseInsensitive | When true, pattern matching ignores case. |
QueryStringPolicy | Append keeps original query string; Drop discards it. |
SkipFurtherRules | When true, no subsequent rules are processed if this rule matches. |
| Value | HTTP Status | Description |
|---|---|---|
Found | 302 | Temporary redirect. |
MovedPermanently | 301 | Permanent redirect; clients should update bookmarks. |
TemporaryRedirect | 307 | Temporary redirect; preserves HTTP method (POST stays POST). |
PermanentRedirect | 308 | Permanent redirect; preserves HTTP method. |
{
"steps": [
{
"name": "UrlRewriting",
"Rules": [
{
"Source": "Redirect",
"Name": "Redirect old-page to new-page",
"Pattern": "^/old-page$",
"SubstitutionPattern": "/new-page",
"IsCaseInsensitive": true,
"QueryStringPolicy": "Append",
"RedirectType": "MovedPermanently"
},
{
"Source": "Redirect",
"Name": "Redirect legacy blog URLs",
"Pattern": "^/blog/post/(\\d+)$",
"SubstitutionPattern": "/articles/$1",
"IsCaseInsensitive": true,
"QueryStringPolicy": "Drop",
"RedirectType": "MovedPermanently"
},
{
"Source": "Rewrite",
"Name": "Serve media from img path",
"Pattern": "^/img/(.*)$",
"SubstitutionPattern": "/media/$1",
"IsCaseInsensitive": true,
"QueryStringPolicy": "Drop",
"SkipFurtherRules": true
}
]
}
]
}
The UrlRewriting step (requires OrchardCore.Recipes.Core) updates a rule when its Id matches an existing rule; otherwise it creates one from Source. Validation errors are reported and the rule is skipped. There is no dedicated deployment step; re-create rules from a recipe in each environment.
using Microsoft.AspNetCore.Rewrite;
using Microsoft.Extensions.Localization;
using OrchardCore.UrlRewriting;
using OrchardCore.UrlRewriting.Models;
namespace MyModule.UrlRewriting;
public sealed class CustomRuleSource : IUrlRewriteRuleSource
{
public const string SourceName = "CustomRule";
public CustomRuleSource(IStringLocalizer<CustomRuleSource> stringLocalizer)
{
DisplayName = stringLocalizer["Custom rule"];
Description = stringLocalizer["Redirects requests to the www host."];
}
public string TechnicalName => SourceName;
public LocalizedString DisplayName { get; }
public LocalizedString Description { get; }
public void Configure(RewriteOptions options, RewriteRule rule)
{
if (!rule.TryGet<CustomRuleMetadata>(out var metadata) || string.IsNullOrEmpty(metadata.Host))
{
return;
}
// Add any ASP.NET Core rewrite rule.
options.AddRedirectToWwwPermanent(metadata.Host);
}
}
public sealed class CustomRuleMetadata
{
public string Host { get; set; }
}
Rule data from the recipe (or IRewriteRulesManager.NewAsync(source, data) / UpdateAsync(rule, data)) reaches your source through an IRewriteRuleHandler. Derive from RewriteRuleHandlerBase and store your metadata on the rule (RewriteRule is an Entity):
using OrchardCore.Entities;
using OrchardCore.UrlRewriting.Handlers;
using OrchardCore.UrlRewriting.Models;
namespace MyModule.UrlRewriting;
public sealed class CustomRuleHandler : RewriteRuleHandlerBase
{
public override Task InitializingAsync(InitializingRewriteRuleContext context)
=> PopulateAsync(context.Rule, context.Data);
public override Task UpdatingAsync(UpdatingRewriteRuleContext context)
=> PopulateAsync(context.Rule, context.Data);
private static Task PopulateAsync(RewriteRule rule, System.Text.Json.Nodes.JsonNode data)
{
if (rule.Source != CustomRuleSource.SourceName)
{
return Task.CompletedTask;
}
var metadata = rule.GetOrCreate<CustomRuleMetadata>();
var host = data[nameof(CustomRuleMetadata.Host)]?.GetValue<string>();
if (!string.IsNullOrEmpty(host))
{
metadata.Host = host;
}
rule.Put(metadata);
return Task.CompletedTask;
}
}
Override ValidatingAsync to reject invalid data with context.Result.Fail(new ValidationResult(...)).
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Localization;
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.DisplayManagement.Views;
using OrchardCore.UrlRewriting;
using OrchardCore.UrlRewriting.Models;
namespace MyModule.UrlRewriting;
public sealed class CustomRuleDisplayDriver : DisplayDriver<RewriteRule>
{
internal readonly IStringLocalizer S;
public CustomRuleDisplayDriver(IStringLocalizer<CustomRuleDisplayDriver> stringLocalizer)
{
S = stringLocalizer;
}
public override IDisplayResult Edit(RewriteRule model, BuildEditorContext context)
{
if (model.Source != CustomRuleSource.SourceName)
{
return null;
}
return Initialize<CustomRuleViewModel>("CustomRule_Fields_Edit", viewModel =>
{
// Populate view model from model properties.
}).Location(l => l.Zone("Content", "5").Card(S["Custom rule"], "20"));
}
public override async Task<IDisplayResult> UpdateAsync(RewriteRule model, UpdateEditorContext context)
{
if (model.Source != CustomRuleSource.SourceName)
{
return null;
}
var viewModel = new CustomRuleViewModel();
await context.Updater.TryUpdateModelAsync(viewModel, Prefix);
// Apply view model values to the model.
return Edit(model, context);
}
}
public class CustomRuleViewModel
{
public string CustomProperty { get; set; }
}
using OrchardCore.DisplayManagement.Handlers;
using OrchardCore.Modules;
using OrchardCore.UrlRewriting;
using OrchardCore.UrlRewriting.Models;
namespace MyModule;
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.AddRewriteRuleSource<CustomRuleSource>(CustomRuleSource.SourceName)
.AddScoped<IRewriteRuleHandler, CustomRuleHandler>()
.AddScoped<IDisplayDriver<RewriteRule>, CustomRuleDisplayDriver>();
}
}
| Scenario | Pattern | Substitution | Type |
|---|---|---|---|
| Exact page redirect | ^/about-us$ | /about | MovedPermanently |
| Path prefix redirect | ^/old-blog/(.*)$ | /blog/$1 | MovedPermanently |
| Trailing slash removal | ^(.+)/$ | $1 | MovedPermanently |
| Legacy ID to slug | ^/post/(\\d+)$ | /articles/$1 | MovedPermanently |
| Scenario | Pattern | Substitution | SkipFurtherRules |
|---|---|---|---|
| Media alias | ^/img/(.*)$ | /media/$1 | true |
| API versioning | ^/api/v1/(.*)$ | /api/v2/$1 | true |
| Clean URLs | ^/page/(.*)$ | /content/$1 | false |
AdminList (List or Grid layout, page size selection, breadcrumbs). A theme or module that overrides Views/Admin/Index.cshtml of OrchardCore.UrlRewriting must render the List context with the <admin-list> tag and keep the rows-id/rows-data-sort-url attributes (RowsAttributes), or drag sorting stops working in the Grid layout.Official Orchard Core videos shown on the documentation page:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/orchardcore:orchardcore-url-rewritingfrom orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin orchardcore140 skills in this plugin
/orchardcore-adminGuidance for the Orchard Core admin panel, including admin controllers and routes, admin menu registration with AdminNavigationProvider, ocat editor forms grouped in cards, admin pages rendering Model.Editor, the UI text casing standard, TheAdmin layout and menu colors, admin branding, the Navbar shape, the Ctrl+K quick navigation palette and QuickNavigationSource, AdminSettings such as MenuBehavior, ShowBreadcrumb, DisplayQuickNavigation, DisplayTitlesInTopbar and ActionsLayout, the AdminDashboard shape, settings pages, and admin filters and zones. Use this skill when requests mention the Orchard Core admin panel, TheAdmin, admin controllers, admin menu registration, an icon on an admin menu item, the AdminSettings recipe step, quick navigation, navigation menu behavior, the admin URL prefix, UI text casing. Strong matches include OrchardCore.Admin, AdminSettings, AdminPermissions, AdminOptions, AdminAttribute, SiteDisplayDriver, IDisplayManager./orchardcore-admin-dashboardSkill for creating admin dashboard widgets in Orchard Core. Covers the DashboardWidget stereotype, DashboardPart position and sizing, the built-in HtmlDashboardWidget, ContentsMetadata and ContentsTags widget types, custom widget content types via recipe or migration, arranging widgets in Manage Dashboard mode, widget template customization, provisioning widgets with recipes, dashboard permissions, the DashboardBreadcrumbProvider Dashboard ancestor, and the AdminDashboardContent shape used when the feature is disabled. Use this skill when requests mention Orchard Core Admin Dashboard, Create and Configure Dashboard Widgets, Enabling Admin Dashboard, Widget Configuration Properties, dashboard widget recipes, Dashboard breadcrumb, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminDashboard, DashboardPart, DashboardBreadcrumbProvider, AccessAdminDashboard, ManageAdminDashboard./orchardcore-admin-edit-viewsSkill for writing Orchard Core admin editor views with the ocat CSS classes and cards. Covers Edit views for content parts and fields, field editor variants, part, field and site settings editors, Fields.Edit views, admin pages rendering Model.Editor built with IDisplayManager, the ocat classes and their layout rules, label associations and group captions, part and field wrapper classes, validation, hints and the Hint_Admin shape, cards declared in placement and the Card and CardContainer shapes, split editor shapes, tabs and columns, the edit page action bar, the horizontal form layout, and the UI text casing standard. Use this skill when requests mention Orchard Core admin edit views, admin forms, grouping fields in cards, Edit.cshtml, Fields.Edit.cshtml, Settings.Edit.cshtml, ocat classes, label casing, or field hints. Strong matches include ocat-wrapper, ocat-card, Hint_Admin, PlacementLocationBuilder, IDisplayManager, ContentPartDisplayDriver, SiteDisplayDriver./orchardcore-admin-listsSkill for Orchard Core 4.0 admin index views (list pages) rendered with the AdminList shape. Covers the List and Grid layouts, AdminListContext of TModel, the admin-list and admin-list-column tag helpers, column width and alignment, row display drivers placing shapes for SummaryAdmin and SummaryAdminGrid, row templates and zones, AdminListActions Buttons and Menu layouts, AdminListToolbar, AdminListSearch, the list-management script for select-all and bulk actions, IAdminListColumnsProvider, AdminListOptions, user layout selection, per-list alternates, sortable lists, and upgrading overridden list views. Use this skill when requests mention Orchard Core admin index views, an admin index page, admin lists, converting a hand-written admin listing, grid layout, list columns, row actions menu, or adding a column to the content items list. Strong matches include OrchardCore.Admin.Abstractions, AdminListContext, AdminListColumn, IAdminListColumnsProvider, AdminListOptions, AdminListLayout, ContentsAdminList./orchardcore-admin-menuSkill for creating admin menus in Orchard Core. Covers admin menu content, the link, placeholder, content types, and lists admin node types, the AdminMenu recipe and deployment step, ManageAdminMenu, ViewAdminMenuAll and per-menu ViewAdminMenu permissions from AdminMenuPermissions, custom admin nodes with AdminNode, IAdminNodeNavigationBuilder and AddAdminNode, data localization of node text, rendering in the 4.0 TheAdmin menu, and upgrading from the removed legacy admin menu layout. Use this skill when requests mention Orchard Core Admin Menu, Create and Manage Admin Menus, Admin Menu Deployment Recipe Step, Built-In Admin Node Types, Custom Admin Node Class, LegacyAdminMenuNavigation, or related implementation, setup, or troubleshooting work. Strong matches include OrchardCore.AdminMenu, OrchardCore.AdminMenu.Abstractions, AdminMenuPermissions, LinkAdminNode, PlaceholderAdminNode, OrchardCore.Lists, OrchardCore.Navigation./orchardcore-admin-schemesSkill for the Orchard Core 4.0 TheAdmin redesign and its admin schemes. Covers scheme records with their four colors, typography, density, corners, horizontal form layout and content width, Design > Themes > Schemes, the default scheme, the per-user scheme picker and its cookie, the seven built-in schemes, the AdminSchemes recipe step and Admin Schemes deployment step, the schemes.css stylesheet, the --ta-* design tokens, ta-content-fluid, dark mode utilities and nested color modes, TheOldAdmin and how to switch to it, and the breaking changes for custom admin themes and Layout overrides. Use this skill when requests mention admin schemes, admin colors, rebranding TheAdmin, dark mode of the admin, the admin content width, the horizontal form layout, TheOldAdmin, or upgrading a custom admin theme to the new TheAdmin. Strong matches include AdminScheme, AdminSchemes, DefaultSchemeId, HorizontalFormLayout, ContentWidth, data-ta-scheme, --ta-primary, ta-content-fluid, TheOldAdmin, and OrchardCore.Themes.TheAdmin.Other plugins' skills for the same job