# thecadams/301redirectmodule architecture

> Architecture diagram of the GitHub repository thecadams/301redirectmodule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thecadams/301redirectmodule
- Repository: https://github.com/thecadams/301redirectmodule

## Overview

##### Main Components

a) Core Components:
- Request Handler Layer
- Redirect Processor
- Rule Engine
- Content Editor Interface
- Configuration System
- Serialization Layer

b) Integration Points:
- Sitecore Content Management System
- Sitecore Pipeline
- HTTP Request/Response System

**[HTTP Request] → [Sitecore Pipeline]**
- ↓
**[Redirect Module Pipeline Processor]**
- ↙          ↓           ↘
**[Rule Engine] [Pattern Matcher] [URL Processor]**
- ↓          ↓           ↓
- [Redirect Manager & Configuration]
- ↓
**[Sitecore Content Database]**
- ↓
**[HTTP Response (301/302 Redirect)]**

##### Key Elements to Highlight

a) Request Processing Flow:
- How incoming requests are intercepted
- Demonstrate the pattern matching process
- Rule evaluation
- Redirect generation

b) Configuration Components:
- Template definitions
- Rule configurations
- Response status codes (301/302)
- Security roles

c) Management Interface:
- Content Editor integration
- Notification system
- Auto-creation of redirects

##### Special Features

- Versioning support
- Internationalization handling
- Automatic redirect creation on item move
- Security role management
- Query string handling

##### Technical Details

Specific components from the source code:
- RedirectProcessor.cs
- AutoCreateRedirectOnMove.cs
- ContentEditorRedirectNotification.cs
- ReplaceString.cs (Rules)
- URLStringCondition.cs

##### Configuration Layer

Configuration files:
- SharedSource.RedirectModule.config
- SharedSource.RedirectModule.Serialisation.config

##### Integration Points

Integration with:
- Sitecore Link Manager
- Content Editor
- Pipeline processors
- Rule Engine

- Component types
- Flow directions
- Special symbols

This will create a comprehensive visualization of how the module integrates with Sitecore while handling various types of redirects, from simple URL mappings to complex pattern-based redirections with query string manipulation.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        L1[Core Sitecore Component]:::sitecore
        L2[Module Component]:::module
        L3[External Interface]:::external
        L4[Configuration/Storage]:::config
        L5[/"Flow Direction"/]
    end

    subgraph "HTTP Layer"
        Request[HTTP Request]:::external
        Response[HTTP Response]:::external
    end

    subgraph "Sitecore Pipeline"
        Pipeline[Sitecore Pipeline Processor]:::sitecore
    end

    subgraph "Module Core"
        RedirectProcessor["Redirect Processor"]:::module
        RuleEngine["Rule Engine"]:::module
        PatternMatcher["Pattern Matcher"]:::module
        URLProcessor["URL Processor"]:::module
        AutoCreate["Auto-Create Redirect"]:::module
        ContentEditor["Content Editor Interface"]:::module
        ResponseHandler["Response Status Handler"]:::module
    end

    subgraph "Configuration & Storage"
        Config["Configuration System"]:::config
        Templates["Template Definitions"]:::config
        RuleConfig["Rule Definitions"]:::config
        SerializationLayer["Serialization Layer"]:::config
        SitecoreDB[(Sitecore Content DB)]:::config
    end

    Request --> Pipeline
    Pipeline --> RedirectProcessor
    RedirectProcessor --> RuleEngine
    RedirectProcessor --> PatternMatcher
    RedirectProcessor --> URLProcessor
    
    RuleEngine --> Config
    PatternMatcher --> Config
    URLProcessor --> Config
    
    Config --> SitecoreDB
    Templates --> SitecoreDB
    RuleConfig --> SitecoreDB
    SerializationLayer --> SitecoreDB
    
    AutoCreate --> SitecoreDB
    ContentEditor --> SitecoreDB
    
    RedirectProcessor --> ResponseHandler
    ResponseHandler --> Response

    %% Click events for component mapping
    click RedirectProcessor "https://github.com/thecadams/301RedirectModule/blob/master/source/Processors/RedirectProcessor.cs"
    click ContentEditor "https://github.com/thecadams/301RedirectModule/blob/master/source/Processors/ContentEditorRedirectNotification.cs"
    click AutoCreate "https://github.com/thecadams/301RedirectModule/blob/master/source/Handlers/AutoCreateRedirectOnMove.cs"
    click RuleEngine "https://github.com/thecadams/301RedirectModule/tree/master/source/Rules"
    click Config "https://github.com/thecadams/301RedirectModule/tree/master/source/App_Config/Include/SharedSource"
    click SerializationLayer "https://github.com/thecadams/301RedirectModule/blob/master/serialisation/SharedSource.Redirection"
    click ResponseHandler "https://github.com/thecadams/301RedirectModule/blob/master/source/Classes/ResponseStatus.cs"
    click Templates "https://github.com/thecadams/301RedirectModule/blob/master/serialisation/SharedSource.Redirection/Redirect.Templates"
    click RuleConfig "https://github.com/thecadams/301RedirectModule/blob/master/serialisation/SharedSource.Redirection/Redirect.System.Rules"

    classDef sitecore fill:#4B9CD3,stroke:#333,stroke-width:2px
    classDef module fill:#50C878,stroke:#333,stroke-width:2px
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px
    classDef config fill:#A9A9A9,stroke:#333,stroke-width:2px
```
