← All tool references

Developer Tools · not_available

htaccess Redirect Generator

Calculate apache redirect rule from source path, target url, redirect status, preserve query string.

Open public tool

Overview

Category
Developer Tools
API mode
not_available
Processing
client-side
Privacy
no-data-stored

Public descriptor

The descriptor is available without an API key and supplies this tool’s metadata, schemas, modes, and examples.

GET /api/v1/tools/htaccess-redirect-generator

View this descriptor as JSON

Execute availability

This tool is documented as a browser capability. Its execute route does not produce a server-side result; when execution is enabled, it responds with browser_interaction_required and points callers to the public tool page.

POST /api/v1/tools/htaccess-redirect-generator/execute

Authentication is not issued during the preview. A bearer API key is planned for execution after launch.

Input schema

object object; additional properties are not accepted.

source_path · string · required
Enter source path.
target_url · string · required
Enter target url.
status · string · required
Enter redirect status. Accepted values: 301, 302.
preserve_query · string · required
Enter preserve query string. Accepted values: yes, no.
{
    "type": "object",
    "properties": {
        "source_path": {
            "type": "string",
            "description": "Enter source path."
        },
        "target_url": {
            "type": "string",
            "description": "Enter target url."
        },
        "status": {
            "type": "string",
            "description": "Enter redirect status.",
            "enum": [
                "301",
                "302"
            ]
        },
        "preserve_query": {
            "type": "string",
            "description": "Enter preserve query string.",
            "enum": [
                "yes",
                "no"
            ]
        }
    },
    "required": [
        "source_path",
        "target_url",
        "status",
        "preserve_query"
    ],
    "additionalProperties": false
}

Output schema

On a successful execution, schema values appear in data.result.values.

rule · string
Apache redirect rule produced by the tool.
pattern · string
Matched pattern produced by the tool.
flags · string
Flags produced by the tool.
{
    "type": "object",
    "properties": {
        "rule": {
            "type": "string",
            "description": "Apache redirect rule produced by the tool."
        },
        "pattern": {
            "type": "string",
            "description": "Matched pattern produced by the tool."
        },
        "flags": {
            "type": "string",
            "description": "Flags produced by the tool."
        }
    },
    "additionalProperties": false
}

htaccess Redirect Generator worked example

The request body follows the published input schema. The response below shows the success-envelope shape returned after execution is available.

curl -X POST "https://utilitypages.org/api/v1/tools/htaccess-redirect-generator/execute" \
  -H "Content-Type: application/json" \
  -d '{
    "source_path": "/old-page",
    "target_url": "https://example.com/new-page",
    "status": "301",
    "preserve_query": "yes"
}'
{
    "ok": true,
    "data": {
        "slug": "htaccess-redirect-generator",
        "result": {
            "values": {
                "rule": "RewriteRule ^old-page/?$ https://example.com/new-page [R=301,L]",
                "pattern": "^old-page/?$",
                "flags": "R=301,L"
            },
            "display": {
                "display": "RewriteRule ^old-page/?$ https://example.com/new-page [R=301,L]"
            },
            "warnings": [],
            "assumptions": [],
            "steps": []
        }
    },
    "meta": [],
    "request_id": "req_example_123"
}

Errors

api_not_launched · 503
Returned by the current launch gate for every execute request.
invalid_json · 400
Returned when an enabled execute request does not contain valid JSON.
validation_failed · 422
Returned when a request does not satisfy the input schema.
browser_interaction_required · 422
Returned for browser capability tools instead of inventing a server-side result.
tool_not_found · 404
Returned when a requested descriptor slug does not exist.
execution_failed · 503
Returned when an enabled server-side execution cannot complete.