Redirects
Per-site redirect rules in the style of .htaccess, evaluated at the Owbase edge before the request reaches the site. Rule types, order, query string, status codes, www and trailing slash, scheduling, testing, diagnostics, statistics, suggestions for 404s, alerts, webhook, repository rules (owbase.redirects.json), limits, importing .htaccess, nginx, _redirects, CSV and JSON, exporting, API and MCP.
Owbase redirects are per-site rules, in the style of Apache’s .htaccess, that the Owbase edge answers before the request reaches the site. A redirect never goes through your server, costs no extra round trip and works for static and SSR sites, on the <name>.sites.owbase.dev address and on the custom domains attached to the site.
The typical case is a migration: an old PHP or WordPress site has hundreds of .htaccess rules and URLs that Google has indexed for years. You import the file (.htaccess, nginx, _redirects, CSV or JSON), review the preview and save: each line becomes an Owbase rule (see Migrating from .htaccess), and the old URLs keep leading to the right place, with the right status for search engines.
Rules are managed in the console, through the API, the CLI and the AI chat (MCP): one at a time, in a batch or by importing a file. A saved rule takes effect at the edge immediately, with no new deployment.
In the console
Section titled “In the console”In the console, open Sites › your site › Redirects. The tab brings together everything on this page:
- Meters at the top: rules used out of what the plan allows, regex (from Pro up) and redirects in the last 30 days. Close to the limit, Upgrade shows up.
- Rule list, in the order rules run, with search, filters (type, tag, enabled, disabled, unused), 30-day hits per rule and a switch to turn each one on or off. Select several to enable, disable, tag or delete them at once (it’s a single batch).
- New rule and edit: a side panel with every field and a live test — type an old URL and see, before saving, where it goes, with the status and the hops.
- Diagnostics: the banner at the top flags loops, chains and rules that never run, with See diagnostics to reach each one.
- Import: paste or upload the
.htaccess, nginx,_redirects, CSV or JSON file, check the preview and choose merge or replace. - Test URLs: paste up to 500 old URLs and see the final destination of each — the fastest way to check a migration before pointing the domain.
- Export as JSON, CSV,
.htaccess, nginx or_redirects. - Frequent 404s: the paths that returned 404 the most, each with the destination Owbase suggests, the confidence and Accept; Accept high-confidence ones creates several at once, after a preview.
- Site canonical: www and bare domain, trailing slash and use of the deploy’s
_redirectsfile. - Integrations: the project webhooks that receive the
redirects.changedevent and the repository rules (owbase.redirects.json), with the status of the last read and Read now. Rules from the file show at the end of the list with the from repository badge, read-only.
People with the Read-only role see the tab and can test URLs, but can’t create, edit, import or change settings.
How it works
Section titled “How it works”For each request to a site with redirects, the edge does the following, in this order:
- Looks for the first rule that applies (see Order). If it finds one, it responds with that rule’s status and an
X-Owbase-Redirectheader with the rule ID. - With repository rules on, it looks at the rules in the deployment’s
owbase.redirects.json, after the console ones. - With no rule, it applies the site’s canonical settings (www and trailing slash), if enabled, with
X-Owbase-Redirect: canonical. - Otherwise the request goes on to the site. On a static site, the deployment’s
_redirectsfile still applies after the module’s rules, unless the site turns it off (redirectsFile: false).
Requests answered by the edge never reach the site, so they don’t show up in the site logs. When the organization is blocked (for example, a pending payment), the edge doesn’t redirect: the request gets the usual block.
Rule types
Section titled “Rule types”Every rule has a source (source), a destination (destination) and a status (statusCode, default 301). The source is only the path, without the domain; to limit a rule to a domain, use hosts. The destination is a path on the site (/new) or an absolute URL (https://other.com/x).
Exact (exact)
Section titled “Exact (exact)”The exact path. It’s the fastest type (a direct lookup, even with thousands of rules) and the most common one in a migration.
{ "type": "exact", "source": "/about-us.php", "destination": "/about" }The source can require query parameters: /product.php?id=10 only matches when the request has id=10 (see Query string).
Placeholder (placeholder)
Section titled “Placeholder (placeholder)”{name} matches one path segment, and a trailing * matches the rest (it becomes {splat}). The destination uses the same names.
{ "type": "placeholder", "source": "/blog/{year}/{slug}", "destination": "/articles/{slug}" }{ "type": "placeholder", "source": "/index.php/*", "destination": "/{splat}" }To restrict what each {name} accepts, use requirements, with one regular expression per name:
{ "type": "placeholder", "source": "/product/{id}", "requirements": { "id": "[0-9]+" }, "destination": "/shop/p/{id}"}The * can only be at the end of the path, and each {name} appears once. The destination can’t use a name the source doesn’t capture.
/folder/* also matches the folder itself, with an empty {splat}: with the rule /folder/* → /new/{splat}, a request for /folder goes to /new (no stray slash) and /folder/a/b goes to /new/a/b. A single rule covers the folder and everything below it, like Apache’s Redirect /folder /new. To handle the folder differently, create an exact rule for /folder with a lower priority.
Regex (regex)
Section titled “Regex (regex)”A regular expression (JavaScript syntax) over the path. Groups go into the destination as {1}, {2} (and {0}, the whole match) or by name, with (?<name>…) → {name}.
{ "type": "regex", "source": "^/news/(\\d{4})/(\\d{2})/(.+)\\.html$", "destination": "/blog/{1}-{2}/{3}" }- The expression is not anchored on its own: use
^and$to match the whole path. - If the source contains
\?, the expression is tested againstpath?query(for example^/search\.php\?q=(.+)$). In that case use"queryMode": "drop", or the original query also goes to the destination. ignoreTrailingSlashdoesn’t apply to regex: write/?$when you want to accept a trailing slash.
So the edge never hangs on an expression, only linear-cost expressions are accepted:
- no backreferences (
\1,\k<name>); - no lookahead or lookbehind (
(?=…),(?!…),(?<=…),(?<!…)); - no nested quantifiers (
(a+)+,(\w*)*,(a|b)+); - at most 500 characters.
Regex depends on the plan: Starter doesn’t include it (limits). Almost everything a regex does in a migration fits in a placeholder with requirements, which works on every plan.
Other fields
Section titled “Other fields”| Field | Default | What it does |
|---|---|---|
ignoreCase |
true |
Ignores case in the path and the query (/About = /about). |
ignoreTrailingSlash |
true |
/about and /about/ are the same path (exact and placeholder). |
queryMode |
keep |
keep carries the request’s query to the destination; drop discards it. |
hosts |
all | Domains where the rule applies (up to 20), without https:// or port. Empty = all of the site’s domains. |
methods |
all | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS. Empty = all. |
startsAt, endsAt |
— | Scheduling, in ISO 8601. |
enabled |
true |
When off, the rule stays saved but doesn’t run. |
priority |
100 |
From 0 to 1,000,000; lower runs first. |
tags |
— | Up to 10 tags of up to 40 characters, to organize and filter. |
description |
— | Up to 500 characters. |
The path is compared already decoded: /promoção and /promo%C3%A7%C3%A3o are the same path. Source and destination are up to 2,048 characters, start with / (the destination can also be http:// or https://, never //) and don’t accept spaces: write %20.
Order and priority
Section titled “Order and priority”Rules run by ascending priority and, within the same priority, in creation order. The first one that applies wins, and no other is evaluated (like Apache’s [L] on every rule). Exact, placeholder and regex rules compete in the same order: a placeholder with priority 10 beats an exact rule with priority 100.
A rule “applies” when it’s enabled, within its schedule, on its method and domain, and when the path and the query match. For an exception to run before a general rule, give it a lower priority:
[ { "source": "/blog/keep-this", "destination": "/blog/keep-this-new", "priority": 10 }, { "type": "placeholder", "source": "/blog/*", "destination": "https://blog.example.com/{splat}", "priority": 100 }]The diagnostics warn when a rule never runs because an earlier one already matches the same source.
Query string
Section titled “Query string”Conditions in the source. Exact and placeholder rules accept the query in the source itself:
| Source | Matches when the request has |
|---|---|
/product.php?id=10 |
id equal to 10 |
/product.php?id={id} |
id with any value (captured in {id}; use requirements to restrict it) |
/search.php?preview |
preview, with any value |
Extra parameters in the request don’t get in the way: /product.php?id=10&utm_source=x also matches /product.php?id=10.
What goes to the destination. With queryMode: "keep" (default), the request’s parameters go on to the destination, except the ones the source used as a condition. If the destination already has a parameter with the same name, the destination’s value wins. With drop, nothing goes on.
{ "type": "placeholder", "source": "/product.php?id={id}", "requirements": { "id": "[0-9]+" }, "destination": "/products/{id}" }/product.php?id=10&utm_source=news → /products/10?utm_source=news.
Which status to use
Section titled “Which status to use”| Status | When to use it |
|---|---|
301 |
Permanent move (default). It’s what search engines read as “this page has a new address”, and it passes ranking signals to the new URL. |
308 |
Permanent, keeping the method and the body. Use it on routes that receive POST (forms, APIs); with 301, the browser may switch POST to GET. |
302 |
Temporary: campaign, maintenance, provisional page. Search engines keep the old URL. |
307 |
Temporary, keeping the method and the body. |
303 |
After a POST, sends to a GET page (a “thank you” page, for example). |
410 |
Content permanently removed, with no replacement. Search engines drop the URL from the index faster than with a 404. |
404 |
The path doesn’t exist, even if the site has something there. |
451 |
Removed for legal reasons. |
404, 410 and 451 have no destination and respond with a neutral, unbranded page, in Portuguese or English depending on the visitor’s browser.
Permanent redirects (301 and 308) are sent with Cache-Control: public, max-age=3600, and browsers tend to remember them on their own. When in doubt, start with 302, check it, and then switch to 301. Temporary ones are sent with no-cache, and 404, 410 and 451 with 5 minutes of cache.
Point straight to the final destination: redirecting an old page to another page that also redirects (a chain) costs the visitor time and a bit of search ranking. The diagnostics flag chains.
www and trailing slash
Section titled “www and trailing slash”Each site has canonical settings, which apply to every path and don’t count as rules:
| Field | Values | What it does |
|---|---|---|
www |
off (default), to-apex, to-www |
Sends www.example.com to example.com (to-apex) or the other way around (to-www). |
trailingSlash |
keep (default), add, remove |
Adds or removes the trailing slash. |
redirectsFile |
true (default), false |
With false, the deployment’s _redirects file stops applying (static site). |
The canonical redirect responds 301, only on GET and HEAD, and keeps the query. It only kicks in when no rule matched. The www switch only happens when both names are domains of the site (add example.com and www.example.com under Custom domain); otherwise the redirect would lead to an address that doesn’t answer. add never touches the root or files with an extension (/logo.png stays without a slash).
You don’t need a rule to send http:// to https://: HTTPS is handled at the edge.
Scheduling
Section titled “Scheduling”startsAt and endsAt (ISO 8601, for example 2026-12-24T00:00:00-03:00) limit when the rule runs. It starts applying at startsAt and stops at endsAt. Either one can be empty.
{ "source": "/christmas", "destination": "/campaigns/christmas-2026", "statusCode": 302, "startsAt": "2026-12-01T00:00:00-03:00", "endsAt": "2026-12-26T00:00:00-03:00"}After endsAt, the rule stays saved but no longer runs. The diagnostics flag expired rules.
Testing and diagnostics
Section titled “Testing and diagnostics”Test. POST …/test takes up to 500 URLs and responds, for each one, with the path a browser would follow: each hop (the rule or the canonical setting that answered), the final URL, the final status and whether there was a loop (loop), a chain (chain, more than one hop) or an exit to another domain (external). The test follows up to 10 hops within the site’s domains.
The test accepts hypothetical operations: send the rules you plan to create, edit or delete in operations (and a hypothetical config, if needed), and the test responds with how the site would behave, without saving anything. It’s how you check a whole migration before applying it.
Diagnostics. GET …/diagnostics reviews the site’s rule set:
| Code | Severity | What it means |
|---|---|---|
redirect_loop |
error | The destination leads back into a loop; the browser gives up with an error. |
redirect_self |
error | The destination is the same as the source. |
redirect_shadowed |
warning | An earlier rule already matches the same (exact) source, so this one never runs. Lower its priority or delete the other one. |
redirect_duplicate |
warning | Same source, domains and methods as an earlier rule: this one never runs. |
redirect_chain |
warning | The destination falls into another rule; point straight to the final destination. |
redirect_expired |
warning | The schedule has ended; delete the rule or extend endsAt. |
The batch (POST …/batch) also returns the diagnostics, with the batch’s rules already applied.
Statistics and 404 suggestions
Section titled “Statistics and 404 suggestions”GET …/stats shows, for the plan’s period:
- the hits of each rule, split between people and bots (by
User-Agent), and the last day it ran; - hits per day;
- the unused rules in the period, good candidates for deletion;
- the paths that returned 404 on the site (the 100 most frequent), as suggestions for new rules. It’s the list of what’s still left to migrate.
404 paths are only collected for sites with the module active: at least one rule or a non-default canonical setting. Counts reach the statistics within 1 minute.
Suggestions for 404s
Section titled “Suggestions for 404s”For each path that returned 404, Owbase proposes the most likely destination within the site itself (GET …/suggestions, the console’s Frequent 404s card and the MCP tool owbase_redirects_suggest). Candidates come, in this order:
- from the site’s
sitemap.xml(and the sitemaps it points to), read by the edge like_redirectsand kept for 10 minutes; - from pages the site recently answered with
200; - from the destinations of existing rules.
The comparison uses the words in the path (without accents and without .php, .html, .asp), with more weight on the last segment; matching numbers count a lot (/produto.php?id=10 matches /produtos/camiseta-10); typos and renamed folders (/blog-antigo/x → /blog/x) too. An image or PDF only matches the same file name in another folder. Each path gets up to 3 candidates, each with a score (0 to 1), the reason and the source, plus a confidence:
confidence |
When |
|---|---|
alta (high) |
The best candidate stands out from the second (or is almost certain, like the same number and a word in common). |
media (medium) |
Likely, but worth checking. |
baixa (low) |
Just a guess: review before accepting. |
null |
No similar page on the site. |
Bot scan paths (/wp-admin, /wp-login.php, .env, .git, phpmyadmin, .bak files and the like) come with probe: true and no candidates: don’t redirect them. 404s that a rule already solves (created after the hit) don’t show up.
Accepting a suggestion creates an exact 301 rule to the best candidate (the response has it ready in suggestedRule); through the API, it’s the usual batch with create operations. In the console, Adjust and the other options open the rule panel filled in, and Accept high-confidence ones shows a preview (with how much of the plan ends up in use) and saves everything in one batch.
Alerts
Section titled “Alerts”Owbase alerts in the console’s notification bell:
| Alert | Who | When |
|---|---|---|
| Redirects at 80% of the plan | Owner | The project’s rules (all sites together) cross 80% of the plan limit. Once a month. |
| Redirect limit reached | Owner | The rules reach 100% of the limit: new rules and imports don’t go in until you delete rules or upgrade. Once a month. |
| 404s spiking | Owner and Developer | A site’s 404s for the day go over 50 and over 3× the average of the previous 7 days — a migration may have broken links. Checked every 10 minutes, one alert per site per day. |
Clicking opens the site’s Redirects tab: the plan meter (with Upgrade) or the Frequent 404s card, with the suggestions.
Plan limits
Section titled “Plan limits”| Starter | Pro | Scale | |
|---|---|---|---|
| Rules per project (across all sites) | 20 | 100 | 500 |
| Regex rules (within the total) | — | 10 | 50 |
| Statistics history | 30 days | 90 days | 365 days |
Every response the edge gives through the module (redirect, canonical, 404, 410 and 451) counts as one request in the plan’s monthly quota (plans and pricing), just as if it had reached the site.
Going over the limit is refused with 403 owbase_redirects_limit_reached, with the limit, the resulting usage and the upgrade link. Only what increases usage is refused: a project above the limit (after moving to a smaller plan) can still edit and delete rules, and the existing ones keep working.
When importing, the limit is checked in the preview: it tells you how many of the file’s rules fit in the plan and which ones would be left out, before anything is saved.
Importing a file
Section titled “Importing a file”Instead of writing rule by rule, send the redirect file from the old server. Owbase converts each line, shows a preview with everything that went in and everything that was left out (with the reason), and only saves when you ask.
Formats
Section titled “Formats”format |
What it reads |
|---|---|
htaccess |
Apache .htaccess: RewriteRule (with RewriteCond and RewriteBase), Redirect, RedirectPermanent, RedirectTemp, RedirectMatch and ErrorDocument. The contents of <IfModule> are read normally. |
nginx |
nginx configuration snippets: location =, location ~/~*, prefix location with return 301 …, rewrite … permanent/redirect and return 301 https://new.com$request_uri for the whole server. |
netlify |
Netlify and Cloudflare Pages _redirects: :name becomes {name} and :splat becomes {splat}. |
csv |
The export CSV: the first line is the header, with at least source and destination; the other columns (statusCode, hosts, tags…) are optional. |
json |
A list of rules or {"rules": [...], "config": {...}}, as the JSON export produces it (IDs are ignored). |
auto (default) |
Detects it: starting with { or [ is JSON; a header with source is CSV; Apache directives are .htaccess; location, rewrite …; or return …; are nginx; anything else is _redirects. |
The file goes in the content field, as text, up to 512 KiB.
Regex becomes a simple rule
Section titled “Regex becomes a simple rule”Starter has no regex, and simple rules are faster on any plan. So the import always tries the simplest type that does the same thing:
| In the file | Becomes |
|---|---|
^about-us\.html$ (plain text) |
Exact /about-us.html |
^products/([0-9]+)/?$ |
Placeholder /products/{p1} with requirements: {"p1": "[0-9]+"} and an optional trailing slash |
^(en|pt)/home$ |
Placeholder /{p1}/home with requirements: {"p1": "en|pt"} |
^blog/(.*)$ |
Placeholder /blog/* (the destination’s $1 becomes {splat}) |
^category/(.*)\.html$ |
Stays regex: the group may contain slashes and comes before more text |
The destination’s $1, $2 groups become {p1}, {p2}; the query condition’s %1, %2 become {q1}, {q2}. Only what doesn’t fit in a placeholder stays regex, with the note “Kept as a regex rule (Pro and Scale plans)”, and those rules count toward the plan’s regex limit.
Two Apache behaviors the import keeps: without [NC], the imported rule gets ignoreCase: false (Apache is case-sensitive), and Redirect /folder carries the folder and everything below it (it becomes /folder/*).
What becomes settings, not rules
Section titled “What becomes settings, not rules”Some classic .htaccess snippets need no rule on Owbase. They’re taken out of the rule list and show up in config or info:
| In the file | On Owbase |
|---|---|
Force HTTPS (RewriteCond %{HTTPS} off, if ($scheme = http)) |
Nothing: the edge already forces HTTPS. Listed in info as import_https_builtin. |
www → apex (RewriteCond %{HTTP_HOST} ^www\.(.*)$ + RewriteRule ^(.*)$ https://%1/$1) |
config.www: "to-apex" (import_www_config). |
Apex → www (RewriteCond %{HTTP_HOST} !^www\.) |
config.www: "to-www" (import_www_config). |
Remove the trailing slash (RewriteRule ^(.*)/$ /$1) |
config.trailingSlash: "remove" (import_trailing_slash_config). |
Add a trailing slash (RewriteRule ^(.*[^/])$ /$1/) |
config.trailingSlash: "add" (import_trailing_slash_config). |
ErrorDocument 404 /404.html |
Nothing: put a 404.html at the root of the deployment and the site serves it with status 404 (import_error_document). |
On save, the file’s settings are applied to the site’s canonical settings. To keep the current settings, send "applyConfig": false. Remember that the www switch only works with both domains added to the site.
Step by step
Section titled “Step by step”-
Preview. Send the file without
dryRun(the default istrue). Nothing is saved, and the preview only needs read permission. -
Review. Check the response:
summary: how many rules came out (converted), how many would be created, updated or left unchanged, how many are invalid, how many go over the limit (overLimit), how many lines were left out (skipped) and how many became settings or notices (info);rules: each rule with the file line, the original line, the converted rule, thestatus(created,updated,unchangedorinvalid, withproblems) and thenotes(approximations to double-check);skippedandinfo: the lines that didn’t become rules, withcodeandreason(the reason is in English; the code is stable);fits: whether everything fits in the plan; anddiagnostics: the site’s diagnostics as it would be (loops, chains, rules that never run).
To see the path of real URLs before saving, use the test with the converted rules in
operations. -
Save. Send the same file with
"dryRun": false. The response repeats the preview and adds the site’s ruletotaland the resulting settings (siteConfig).
Merge or replace
Section titled “Merge or replace”mode |
What it does |
|---|---|
merge (default) |
Merges the file into the site’s rules. A rule with the same type, source and domains as an existing one is updated; the site’s other rules stay as they are. |
replace |
The site ends up with only the file’s rules: current rules not in the file are deleted. A file rule with the same source as a current one keeps its ID (and its statistics). Use it when the file is the complete, final list. |
Re-importing is safe. Each rule in the file goes in as an upsert: sending the same file again duplicates nothing, and the preview shows unchanged for what’s already the same. You can import, fix the file and import again as many times as you need.
Plan limit
Section titled “Plan limit”The import respects the plan limits, adding up every site in the project:
| Starter | Pro | Scale | |
|---|---|---|---|
| Rules per project | 20 | 100 | 500 |
| Regex rules | — | 10 | 50 |
When the file doesn’t fit, the preview answers "fits": false, lists in overLimit each rule that would be left out (with the line and the reason: rule limit or regex limit) and includes the upgradeUrl. When saving, you choose:
- Without
partial(default): nothing is saved. The response is403 owbase_redirects_limit_reached, withlimits,summary,overLimitand theupgradeUrl. That way a site never ends up half-migrated without you knowing. - With
"partial": true: rules go in in file order while they fit in the plan, and the ones that would go over the limit are listed inoverLimit. A regex that doesn’t fit on Starter is left out, but the exact and placeholder rules after it still go in. Put the most important rules (the URLs with the most traffic and links) at the top of the file.
Big migration? A site with hundreds of old URLs calls for Pro (100 rules) or Scale (500 rules). Upgrade and send the same file again: the rules already imported stay unchanged, and only the missing ones are created.
Example
Section titled “Example”A typical .htaccess from an old site, 21 lines long:
RewriteEngine On
# force https and drop wwwRewriteCond %{HTTPS} offRewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
RewriteRule ^about-us\.php$ /about [R=301,L]RewriteRule ^products/([0-9]+)/?$ /shop/p/$1 [R=301,L,NC]RewriteCond %{QUERY_STRING} ^id=([0-9]+)$RewriteRule ^product\.php$ /shop/p/%1? [R=301,L]RewriteRule ^promo-2019$ - [G]Redirect 301 /blog https://blog.example.com
# WordPress front controllerRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule . /index.php [L]
ErrorDocument 404 /404.htmlThe preview:
jq -Rs '{content: .}' .htaccess | curl -s -X POST "$OWBASE_API/_owbase/redirects/sites/$SITE/import" \ -H "x-owbase-project: $PROJECT" -H "x-owbase-key: $OWBASE_API_KEY" \ -H "content-type: application/json" --data-binary @-{ "format": "htaccess", "mode": "merge", "dryRun": true, "summary": { "converted": 5, "created": 5, "updated": 0, "unchanged": 0, "invalid": 0, "overLimit": 0, "skipped": 1, "info": 3 }, "limits": { "rules": 20, "regex": 0, "statsDays": 30 }, "fits": true, "config": { "www": "to-apex" }, "rules": [ { "line": 9, "original": "RewriteRule ^about-us\\.php$ /about [R=301,L]", "status": "created", "id": "rdr_…", "rule": { "type": "exact", "source": "/about-us.php", "destination": "/about", "statusCode": 301, "…": "…" }, "notes": [] }, { "line": 10, "original": "RewriteRule ^products/([0-9]+)/?$ /shop/p/$1 [R=301,L,NC]", "status": "created", "id": "rdr_…", "rule": { "type": "placeholder", "source": "/products/{p1}", "requirements": { "p1": "[0-9]+" }, "destination": "/shop/p/{p1}", "…": "…" }, "notes": [] }, { "line": 12, "original": "RewriteRule ^product\\.php$ /shop/p/%1? [R=301,L]", "status": "created", "id": "rdr_…", "rule": { "type": "placeholder", "source": "/product.php?id={q1}", "requirements": { "q1": "[0-9]+" }, "destination": "/shop/p/{q1}", "queryMode": "drop", "…": "…" }, "notes": [] }, { "line": 13, "original": "RewriteRule ^promo-2019$ - [G]", "status": "created", "id": "rdr_…", "rule": { "type": "exact", "source": "/promo-2019", "statusCode": 410, "…": "…" }, "notes": [] }, { "line": 14, "original": "Redirect 301 /blog https://blog.example.com", "status": "created", "id": "rdr_…", "rule": { "type": "placeholder", "source": "/blog/*", "destination": "https://blog.example.com/{splat}", "…": "…" }, "notes": [] } ], "overLimit": [], "skipped": [ { "line": 19, "original": "RewriteRule . /index.php [L]", "code": "import_internal_rewrite", "reason": "Internal rewrite (no [R] flag): the URL does not change for the visitor. Owbase redirects only; for SPAs use the fallback file in the site build settings." } ], "info": [ { "line": 5, "code": "import_https_builtin", "reason": "HTTPS is always forced at the Owbase edge; no rule needed.", "…": "…" }, { "line": 7, "code": "import_www_config", "reason": "www → bare domain became the site setting \"www: to-apex\" (both domains must be on the site).", "…": "…" }, { "line": 21, "code": "import_error_document", "reason": "Put a 404.html at the root of your deploy: the site serves it with status 404.", "…": "…" } ], "diagnostics": []}All 5 rules fit on Starter (none is regex): /products/12/ goes to /shop/p/12, /product.php?id=7 to /shop/p/7, /blog to https://blog.example.com and /blog/2020/hi to https://blog.example.com/2020/hi. HTTPS and www became settings, and line 19 was left out: it’s the WordPress front controller, which rewrites internally and doesn’t redirect. On the new site, the framework itself plays that role (or the fallback file, on a static SPA). To save, repeat the request with {content: ., dryRun: false}.
Lines left out
Section titled “Lines left out”Every line that doesn’t become a rule goes into skipped, with one of these codes:
| Code | What it means | What to do |
|---|---|---|
import_internal_rewrite |
Internal rewrite: RewriteRule without [R], nginx rewrite … last/break, or a 200/404 rule in _redirects. The URL doesn’t change for the visitor. |
Nothing to migrate as a redirect. On a static site, use the deployment’s _redirects or the fallback file; on SSR, your server. |
import_forbidden |
[F] (403): an access rule, not a redirect. |
Block access in your code, or create a rule with status 404 to hide the path. |
import_proxy |
[P]: proxy to another server. |
Owbase only redirects: switch to a redirect or serve the content from the site itself. |
import_status_unsupported |
A status other than 301, 302, 303, 307, 308, 404, 410 and 451 (for example, R=403, return 500). |
Pick a supported status (Which status to use) and create the rule by hand. |
import_condition_or |
RewriteCond with [OR]. |
Create one rule per alternative. |
import_condition_unsupported |
A condition the module doesn’t have (cookie, User-Agent, Referer, method, %{ENV:…}, %{TIME}…), a host or query condition that’s too complex, an nginx if block, or a query combined with a regex path. The RewriteRule that depended on it is left out too, with this code. |
Rewrite it with hosts, methods, a query in the source or scheduling, or drop the condition. |
import_variable_unsupported |
The destination uses a server variable (%{…}, nginx $host) or copies the request’s host. |
Spell out the destination domain, or use the www setting. |
import_backreference |
The destination uses a group ($2, %1) that the pattern or condition doesn’t capture. |
Fix the line in the file. |
import_block_unsupported |
A block that depends on files or server state (<Files>, <Directory>, <If>…); the rules inside it are left out. |
Review the block’s rules and create by hand the ones that still make sense. |
import_directive_unsupported |
A directive that isn’t a redirect (Header, ExpiresActive, AddType…). |
Nothing to do: it’s not the module’s business. |
import_context |
nginx: return outside a location (other than moving the whole domain) or an unknown location modifier. |
Create the rule by hand, with the right path. |
import_syntax |
Malformed line, - without [G], CSV without a header, invalid JSON. |
Fix the file and import again. |
Directives with no effect on the module (RewriteEngine, RewriteOptions, Options and, in nginx, listen, server_name, root and the like) are skipped silently.
Besides skipped, keep an eye on:
invalidinrules[].status: the line was converted, but the rule doesn’t pass validation (a regex with a backreference, for example). Theproblemssay why, with the same codes as the API.noteson each rule: approximations to double-check (see the table below).
Preview notes
Section titled “Preview notes”Each note comes with a stable code, the message in English and, when the text mentions something from the file, the params. The console translates the note by its code; the AI (through MCP) gets the code and the message.
{ "code": "import_note_file_condition_dropped", "message": "Condition \"RewriteCond %{REQUEST_FILENAME} !-f\" (file exists) was dropped: Owbase checks rules before the site's files.", "params": { "condition": "RewriteCond %{REQUEST_FILENAME} !-f", "line": 18 } }| Code | When it shows up | What to check |
|---|---|---|
import_note_regex_plan |
The expression could not be simplified into an exact or placeholder rule and stayed regex. |
Regex is only on the Pro and Scale plans; on Starter, the rule is left out by the limit. See whether it can be rewritten as a placeholder. |
import_note_file_condition_dropped |
A file condition (!-f, !-d) was dropped. params: condition (the line) and line. |
Owbase evaluates rules before the site’s files: the rule applies even when the file exists. Make sure the source doesn’t match real file paths. |
import_note_https_dropped |
The https condition was dropped (the edge already forces HTTPS), and the rule went on without it. | Usually nothing: the rule now also applies to visitors who already arrived over HTTPS. |
import_note_whole_site |
nginx: a return for a whole server block (return 301 https://new.com$request_uri) became /*. |
The rule applies on every domain of the site. If only the old domain should redirect, set the rule’s hosts. |
import_note_prefix_location |
nginx: location /folder (prefix, or ^~) became /folder/*. params: location. |
The rule covers everything below the path. If only the exact path should redirect, switch to an exact rule. |
Exporting
Section titled “Exporting”GET …/sites/<site>/export?format=… returns the site’s rules as a file, for backup, for review in a spreadsheet or to mirror on a server outside Owbase:
format |
File | What can’t be expressed (commented out with # não exportada) |
|---|---|---|
json (default) |
{siteId, config, rules} |
Nothing: it’s the complete format, and it comes back identical through the import. |
csv |
redirects-<site>.csv |
Doesn’t carry the site settings: for a complete backup, use JSON. Columns: id, type, source, requirements (JSON), destination, statusCode, queryMode, ignoreCase, ignoreTrailingSlash, hosts, methods, startsAt, endsAt, enabled, priority, tags, description. |
htaccess |
.htaccess (mod_rewrite) |
Disabled rules, scheduled rules, rules limited to methods and rules with status 404 or 451. www becomes the RewriteCond lines; the trailing slash setting isn’t included. |
nginx |
redirects-<site>.nginx.conf, to paste inside server { } |
Disabled rules, scheduled rules, rules limited to methods or domains and rules with a query condition. Trailing slash remove becomes a rewrite; www isn’t included. |
netlify |
_redirects (Netlify, Cloudflare Pages) |
Regex, rules with requirements, query, domains, methods, scheduling, disabled rules and status 451. 404 and 410 point to /404.html. |
Exporting only needs read permission. To move rules from one Owbase site to another, use JSON: it’s the only format that comes back exactly the same through the import. The others are meant for the destination server; re-imported, they come back with the same behavior and nothing is duplicated (the same source updates the rule), but placeholder names become {p1}, {p2}.
Redirects as code (owbase.redirects.json)
Section titled “Redirects as code (owbase.redirects.json)”To keep rules in the site’s repository, next to the code, turn on Repository rules under Integrations (or codeFile: true in the settings) and put an owbase.redirects.json file at the root of the deployment output (the published folder, like dist/). The format is the same as the JSON export: { "rules": [...], "config": {...} }, or just the list of rules.
{ "rules": [ { "source": "/colecao-inverno", "destination": "/colecoes/inverno", "statusCode": 301 }, { "type": "placeholder", "source": "/lookbook/*", "destination": "/colecoes/{splat}" }, { "source": "/trabalhe-conosco", "destination": "https://vagas.exemplo.com.br", "statusCode": 302 } ]}- When it applies: the edge reads the file through the site’s own domain at most once a minute, so a new deployment applies within 1 minute, with no deploy hook. Read now (in the console) or
POST …/file/refreshreads it right away. - Order: the file’s rules run after the console rules (and the API and MCP ones) and before the canonical settings and
_redirects. Among themselves, the usual order applies. - Plan limit: they use what’s left of the limit after the project’s console rules. The ones over it are left out (
ignoredOverLimit) and the console warns, with the upgrade invite. - Read-only outside the file: in the console they show at the end of the list with the from repository badge, with no editing or switching off; to change one, edit the file and deploy. Each rule has a stable id (
arq_…, from type, source and domains), so statistics carry over from one deployment to the next. - Problems: each rule is validated as in the API; rules with problems don’t go in and show with their position in the file (
index, from 0) and theproblems. A file that isn’t JSON (invalid), a missing file (missing) or a site that didn’t answer (error) also show in the status. - Not public: with the option on,
owbase.redirects.jsonis never served to visitors (it answers 404). The file’sconfigis informational only: the canonical settings that apply are the console’s.
redirects.changed webhook
Section titled “redirects.changed webhook”Under Integrations, pick up to 5 project webhooks to receive the redirects.changed event on every save to the site’s redirects: a rule created, edited or deleted, a batch, an import and the settings. The delivery leaves Owbase with the webhook’s signature, custom headers, Basic authentication and body template, and goes into the same delivery history.
POST /hooks/owbase HTTP/1.1Content-Type: application/jsonX-Owbase-Webhook-Id: <WEBHOOK>X-Owbase-Webhook-Delivery-Id: redirects-mi9k2x-4f1aX-Owbase-Webhook-Events: redirects.changedX-Owbase-Webhook-Name: Purge CDN cacheX-Owbase-Webhook-Project-Id: <PROJECT>X-Owbase-Webhook-Signature: <HMAC-SHA1 base64>
{ "event": "redirects.changed", "projectId": "<PROJECT>", "siteId": "loja", "action": "batch", "by": "session", "total": 19, "created": 3, "updated": 0, "deleted": 0, "$createdAt": "2026-12-01T13:05:22.418Z"}action is create, update or delete (with ruleIds), batch (with created, updated and deleted), import (with format, mode, created and updated) or config (with the new config). by says where the change came from: session (console), key (API key) or mcp. total is how many rules the site has after the change.
The secret must be known. Owbase can only sign after the server’s first delivery of that webhook or a secret generated in the console. Until then, that webhook doesn’t get redirects.changed, and the Integrations card warns, with a Generate new secret shortcut. A disabled webhook doesn’t get it either.
All routes live under https://cloud.owbase.dev/_owbase/redirects, take and return JSON, and require the project in the X-Owbase-Project header plus a credential: the project’s API key in the X-Owbase-Key header or the console session. The examples use:
export OWBASE_API=https://cloud.owbase.devexport PROJECT=<PROJECT_ID>export OWBASE_API_KEY=<API_KEY>export SITE=<SITE_ID>Permissions. Reading, testing, viewing statistics and exporting require a credential that can see the site (sites.read scope). Creating, editing, deleting, saving a batch and changing settings also require the sites.write scope and, with a console session, a role that can write to the project (the Read-only role gets 403 owbase_role_forbidden). Writes are recorded in the Audit log.
| Route | What it does |
|---|---|
GET /_owbase/redirects |
Project overview: limits, usage and, per site, how many rules and regex rules, settings and domains. |
GET /_owbase/redirects/sites/<site> |
The site’s rules, settings, domains, limits and usage. Filters: search, tag, type, enabled, limit (up to 500) and offset. |
GET …/sites/<site>/rules/<id> |
One rule. |
POST …/sites/<site>/rules |
Creates a rule → 201 with the rule. |
PATCH …/sites/<site>/rules/<id> |
Edits only the fields sent → 200 with the rule. |
DELETE …/sites/<site>/rules/<id> |
Deletes → 204. |
POST …/sites/<site>/batch |
Batch of up to 500 operations, atomic, with dryRun. |
POST …/sites/<site>/test |
Test of up to 500 URLs, with hypothetical operations. |
GET …/sites/<site>/diagnostics |
Diagnostics of the rule set. |
GET …/sites/<site>/stats?days=30 |
Statistics; days goes up to the plan’s limit. |
GET …/sites/<site>/suggestions?days=7 |
Suggested destinations for the period’s 404s (default 7 days, up to the plan’s limit). |
POST …/sites/<site>/file/refresh |
Reads the deployment’s owbase.redirects.json now. With codeFile off, 409 owbase_redirects_code_file_off. |
POST …/sites/<site>/import |
Imports an .htaccess, nginx, _redirects, CSV or JSON file. Preview only by default (dryRun: true). |
GET …/sites/<site>/export?format=… |
Exports the rules as json (default, with the settings), csv, htaccess, nginx or netlify. |
PUT …/sites/<site>/config |
Changes www, trailingSlash, redirectsFile, webhooks (up to 5 project webhook IDs; [] turns it off) and codeFile (only the fields sent). |
With codeFile on, GET …/sites/<site> also returns file: path, status (ok, missing, invalid or error), fetchedAt, total (rules that apply), ignoredOverLimit, problems ([{ index, problems }]), message, config and rules (the file’s rules, with arq_… ids).
Create a rule
Section titled “Create a rule”curl -s -X POST "$OWBASE_API/_owbase/redirects/sites/$SITE/rules" \ -H "x-owbase-project: $PROJECT" -H "x-owbase-key: $OWBASE_API_KEY" \ -H "content-type: application/json" \ -d '{"source": "/about-us.php", "destination": "/about", "tags": ["migration"]}'{ "$id": "rdr_4f1c2a9b7e3d4c5a6b7c", "siteId": "shop", "hosts": [], "type": "exact", "source": "/about-us.php", "requirements": {}, "destination": "/about", "statusCode": 301, "queryMode": "keep", "ignoreCase": true, "ignoreTrailingSlash": true, "methods": [], "startsAt": null, "endsAt": null, "enabled": true, "priority": 100, "tags": ["migration"], "description": "", "createdBy": "key", "$createdAt": "2026-11-30T18:00:00.000Z", "$updatedAt": "2026-11-30T18:00:00.000Z"}createdBy tells where the rule came from: key (API key), session (console) or mcp (chat).
POST …/batch applies up to 500 operations at once. The batch is atomic: if one operation has a problem, nothing is saved.
action |
Fields |
|---|---|
create |
rule |
update |
id and rule (only the fields that change) |
upsert |
rule: updates the rule with the same type, source and domains, or creates it. Resending the same batch duplicates nothing. |
delete |
id |
With "dryRun": true, the batch only simulates: it returns the result of each operation, the resulting usage and the diagnostics, without saving (and requires only read permission).
curl -s -X POST "$OWBASE_API/_owbase/redirects/sites/$SITE/batch" \ -H "x-owbase-project: $PROJECT" -H "x-owbase-key: $OWBASE_API_KEY" \ -H "content-type: application/json" \ -d '{ "dryRun": true, "operations": [ { "action": "upsert", "rule": { "source": "/contact.php", "destination": "/contact" } }, { "action": "upsert", "rule": { "source": "/promo-2019", "statusCode": 410 } } ] }'{ "dryRun": true, "ok": true, "results": [ { "index": 0, "action": "upsert", "id": "rdr_…", "status": "created" }, { "index": 1, "action": "upsert", "id": "rdr_…", "status": "created" } ], "limits": { "rules": 100, "regex": 10, "statsDays": 90 }, "usage": { "rules": 14, "regex": 0 }, "diagnostics": []}Without dryRun, the response has "dryRun": false, the results (created, updated, unchanged or deleted), the site’s rule total and the diagnostics.
curl -s -X POST "$OWBASE_API/_owbase/redirects/sites/$SITE/test" \ -H "x-owbase-project: $PROJECT" -H "x-owbase-key: $OWBASE_API_KEY" \ -H "content-type: application/json" \ -d '{ "urls": ["/about-us.php", "/christmas"], "operations": [{ "action": "create", "rule": { "source": "/christmas", "destination": "/about-us.php", "statusCode": 302 } }] }'{ "hypothetical": true, "operations": [{ "index": 0, "action": "create", "id": "tmp_…", "status": "created" }], "summary": { "total": 2, "matched": 2, "loops": 0, "chains": 1 }, "results": [ { "url": "/about-us.php", "matched": true, "steps": [{ "url": "https://shop.sites.owbase.dev/about-us.php", "statusCode": 301, "ruleId": "rdr_…", "kind": "rule", "location": "/about" }], "finalUrl": "https://shop.sites.owbase.dev/about", "finalStatusCode": null, "loop": false, "chain": false, "external": false }, { "url": "/christmas", "matched": true, "steps": [ { "url": "https://shop.sites.owbase.dev/christmas", "statusCode": 302, "ruleId": "tmp_…", "kind": "rule", "location": "/about-us.php" }, { "url": "https://shop.sites.owbase.dev/about-us.php", "statusCode": 301, "ruleId": "rdr_…", "kind": "rule", "location": "/about" } ], "finalUrl": "https://shop.sites.owbase.dev/about", "finalStatusCode": null, "loop": false, "chain": true, "external": false } ]}finalStatusCode: null means the last request goes on to the site (which answers with whatever it has). kind is rule (a module rule) or canonical (www or trailing slash). method in the body tests another method (default GET).
Statistics
Section titled “Statistics”{ "days": 30, "daily": [{ "date": "2026-11-29", "hits": 412 }], "rules": [{ "id": "rdr_…", "source": "/about-us.php", "destination": "/about", "hits": 380, "humans": 301, "bots": 79, "lastHit": "2026-11-29" }], "unusedRules": ["rdr_…"], "notFound": [{ "path": "/catalog.php", "hits": 57 }]}Suggestions
Section titled “Suggestions”{ "days": 7, "candidates": { "sitemap": 48, "visited": 112, "rules": 9 }, "total": 2, "suggestions": [ { "path": "/produtos.php?categoria=verao", "hits": 157, "lastSeen": "2026-11-30", "confidence": "alta", "probe": false, "candidates": [ { "destination": "/colecoes/verao", "score": 0.82, "reason": "words in common: verao", "source": "sitemap" }, { "destination": "/produtos", "score": 0.41, "reason": "words in common: produtos", "source": "sitemap" } ], "suggestedRule": { "type": "exact", "source": "/produtos.php?categoria=verao", "destination": "/colecoes/verao", "statusCode": 301 } }, { "path": "/wp-admin/install.php", "hits": 38, "lastSeen": "2026-11-30", "confidence": null, "probe": true, "candidates": [], "suggestedRule": null } ]}The top-level candidates says how many pages each source offered. reason is in English, in parts separated by ; (words in common: …, same number …, similar last segment, same file name (…)). To accept, send the suggestedRule objects to the batch as create operations.
Import and export
Section titled “Import and export”POST …/sites/<site>/import takes:
| Field | Default | What it does |
|---|---|---|
content |
— | The file’s text (required, up to 512 KiB). |
format |
auto |
auto, htaccess, nginx, netlify, csv or json (formats). |
mode |
merge |
merge adds to what the site has; replace leaves the site with only the file (merge or replace). |
dryRun |
true |
Preview: saves nothing and only needs read access. false saves (needs sites.write). |
partial |
false |
Above the plan limit, saves the rules that fit, in file order. Without it, nothing is saved and the response is 403 (limit). |
applyConfig |
true |
Applies the www and trailing slash the file asked for to the site’s canonical settings. |
The response includes format (the detected one), mode, dryRun, summary (converted, created, updated, unchanged, invalid, overLimit, skipped, info), limits, fits (and upgradeUrl when it doesn’t fit), config, rules, overLimit, skipped, info and diagnostics; after saving, also total and siteConfig. See the example.
GET …/sites/<site>/export?format=json|csv|htaccess|nginx|netlify returns the file with Content-Disposition: attachment (what each format carries). Any other format value answers 400 general_argument_invalid.
Errors
Section titled “Errors”In the SDK format ({message, code, type}):
type |
Status | When |
|---|---|---|
general_argument_invalid |
400 | X-Owbase-Project is missing, the body isn’t JSON, the batch doesn’t have 1 to 500 operations, the test doesn’t have 1 to 500 URLs, the import has no content (or more than 512 KiB) or the format doesn’t exist. |
owbase_redirect_invalid |
400 | The rule (or the settings) has problems. The response lists all of them at once in problems (or, in the batch and the test, in results[].problems). |
general_unauthorized_scope |
401 | The credential doesn’t have sites.write (writes). |
owbase_role_forbidden |
403 | With a console session: the role can’t write to the project. |
owbase_redirects_limit_reached |
403 | It would go over the plan limit. Includes limits, usage and upgradeUrl (on import: limits, summary, overLimit and upgradeUrl). |
site_not_found |
404 | The site doesn’t exist or the credential can’t see it. |
owbase_redirect_not_found |
404 | The rule doesn’t exist on this site. |
Each item in problems has field, code and message, so everything can be fixed in one pass:
{ "message": "The rule has problems; see \"problems\".", "code": 400, "type": "owbase_redirect_invalid", "problems": [ { "field": "source", "code": "redirect_source_invalid", "message": "\"source\" must start with / (paths only, without the domain; use \"hosts\" to limit the rule to a domain)." }, { "field": "statusCode", "code": "redirect_status_invalid", "message": "\"statusCode\" must be one of: 301, 302, 303, 307, 308, 404, 410, 451." } ]}{ "message": "Your plan allows 0 regex rule(s) per project and this would leave 1. …", "code": 403, "type": "owbase_redirects_limit_reached", "limits": { "rules": 20, "regex": 0, "statsDays": 30 }, "usage": { "rules": 4, "regex": 1 }, "upgradeUrl": "https://owbase.dev/pricing"}The problems codes: redirect_field_unknown, redirect_field_invalid, redirect_type_invalid, redirect_source_required, redirect_source_invalid, redirect_regex_invalid, redirect_requirement_invalid, redirect_requirement_unused, redirect_status_invalid, redirect_destination_required, redirect_destination_invalid, redirect_destination_placeholder and, in the batch, redirect_not_found and redirect_action_invalid.
With the CLI
Section titled “With the CLI”The owbase redirects group does the same on the command line: list, test, import, export, diagnose, suggest and config. apply keeps the rules in a JSON file in your repository, which CI applies to the site: without --yes it shows the plan, and the step fails if a rule has a problem or goes over the plan.
owbase redirects apply redirects.json --site shop # planowbase redirects apply redirects.json --site shop --yes # saveWith AI (MCP)
Section titled “With AI (MCP)”With the project connected to your chat (how to connect), the chat uses these tools:
| Tool | What it does |
|---|---|
owbase_redirects_list |
Lists a site’s rules and settings; with codeFile on, it returns file (status, problems and rules of owbase.redirects.json), and refreshFile: true reads the file right before listing. |
owbase_redirects_import |
Imports a whole file (.htaccess, nginx, _redirects, CSV or JSON). Preview only by default: the chat shows what was converted, what was left out and whether it fits in the plan, and only saves (dryRun: false) once you confirm. |
owbase_redirects_apply |
Applies a batch of operations. By default it only simulates (dryRun: true): the chat shows the result and only saves once you confirm. |
owbase_redirects_export |
Exports the site’s rules as .htaccess, nginx, _redirects, CSV or JSON (formats). Read-only. |
owbase_redirects_test |
Tests URLs, including against rules that haven’t been saved yet. |
owbase_redirects_diagnose |
Runs the diagnostics (loops, chains, rules that never run). |
owbase_redirects_stats |
Statistics and the paths that returned 404. |
owbase_redirects_suggest |
Suggested destinations for the site’s 404s, with confidence, reason and the ready rule. Read-only: the chat shows the high-confidence ones first and saves through owbase_redirects_apply after your approval. |
owbase_redirects_config |
Changes www, trailing slash, the use of _redirects, the webhooks that receive redirects.changed and codeFile for repository rules (the current settings come with owbase_redirects_list). |
A typical request:
Migrate this .htaccess to the shop site. Test the old URLs before saving and show me what can’t be converted. (paste the contents of the
.htaccess)
The chat sends the file to the import in preview mode and shows how many rules came out, the lines left out with the reason, what becomes site settings (www, trailing slash) and whether everything fits in the plan. It can test the old URLs against the rules before they are saved, and it only saves with your approval. If the file goes over the plan limit, the chat tells you and asks whether you’d rather upgrade or import only the first rules that fit.
To take the rules somewhere else, ask the chat for an export, which uses owbase_redirects_export (for example, “export the redirects of the shop site in nginx format”). After migrating, ask “which paths are returning 404 on the shop site? suggest destinations” to find what’s still missing: the chat uses owbase_redirects_suggest, shows the suggestions and only creates the rules you approve.
Migrating from .htaccess
Section titled “Migrating from .htaccess”The import does the conversion below on its own. The table helps you review the preview and write by hand what was left out.
| In Apache | On import |
|---|---|
Redirect 301 /old /new |
Placeholder /old/* → /new/{splat}, 301. Like Apache, it carries the folder and everything below it: /old → /new, /old/x → /new/x. |
Redirect /old /new (no status) |
Same, with 302: it’s Apache’s default. |
RedirectPermanent / RedirectTemp / Redirect gone /old |
301 / 302 / 410. |
RedirectMatch 301 ^/blog/(\d+)$ /article/$1 |
Placeholder /blog/{p1} with requirements: {"p1": "\\d+"} → /article/{p1}. Only what doesn’t fit in a placeholder stays regex (how). |
RewriteRule ^old\.html$ /new [R=301,L] |
Exact /old.html → /new, 301. In .htaccess the pattern has no leading /; the import adds it and honors RewriteBase. |
RewriteRule ^products/([0-9]+)/?$ /p/$1 [R=301] |
Placeholder /products/{p1} with a requirement, and /? becomes ignoreTrailingSlash: true. |
[R] or [R=302]; https://… destination without [R] |
statusCode: 302, as in Apache. |
[L] |
Not needed: the first rule that applies always ends evaluation. |
[NC] |
ignoreCase: true. Without [NC], the imported rule gets ignoreCase: false, because Apache is case-sensitive (by hand, Owbase’s default is true). |
[QSA] |
queryMode: "keep". |
[QSD], a destination ending in ? or a destination with a query and no [QSA] |
queryMode: "drop". |
[G] or - with [G] |
statusCode: 410, no destination. |
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ |
hosts: ["example.com", "www.example.com"]. Alternatives with | become several domains. |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ + RewriteRule ^(.*)$ https://%1/$1 |
Setting www: "to-apex" (and !^www\., "to-www"), not a rule. |
RewriteCond %{HTTPS} off (force HTTPS) |
Nothing: the edge already forces HTTPS. |
RewriteCond %{QUERY_STRING} ^id=([0-9]+)$ |
Query in the source: /product.php?id={q1} with requirements: {"q1": "[0-9]+"}, and {q1} in the destination instead of %1. (^|&)id=([0-9]+)(&|$) works too. |
RewriteCond %{REQUEST_FILENAME} !-f / !-d |
The condition is dropped (with a note): Owbase evaluates rules before the site’s files. |
RewriteRule ^(.*)/$ /$1 [R=301] / ^(.*[^/])$ /$1/ |
Setting trailingSlash: "remove" / "add", not a rule. |
ErrorDocument 404 /404.html |
Nothing: a 404.html at the deployment root is already served with status 404. |
<IfModule mod_rewrite.c> |
Its contents are imported normally. |
By hand (the import leaves these out, with the code in skipped):
| In Apache | On Owbase |
|---|---|
RewriteCond %{REQUEST_METHOD} POST |
methods: ["POST"] on the rule. |
Several RewriteCond lines with [OR] |
One rule per alternative. |
RewriteMap |
Each line of the map becomes an exact rule (a CSV with source,destination imports the whole map). |
What has no equivalent:
- Internal rewrites (
RewriteRulewithoutR, which serves another file without changing the URL). The module only redirects or responds 404/410/451. On a static site, the200rule in_redirectsdoes the rewrite; on SSR, your server does. - Proxying (
[P]) to another server. - File and directory conditions (
-f,-d,-s). On a static site, the200and404rules in_redirectsonly apply when the path has no file, which covers the common SPA case. - Conditions on cookies,
User-Agent,Referer, language, country, environment variables (%{ENV:…}) or time (%{TIME}; for dates, use scheduling). - A destination that copies the request host (
https://%{HTTP_HOST}/…) or another server variable: spell out the domain. <Files>,<Directory>,<If>blocks and the like.[F](403) and any status other than 301, 302, 303, 307, 308, 404, 410 and 451.- Regex with backreferences, lookaround or nested quantifiers.