Перейти к основному содержанию

Генератор перенаправления .htaccess

Создавайте правила перенаправления и контроля доступа Apache .htaccess: произвольные перенаправления пути (301/302), перенаправление миграции всего домена и список разрешений/блокировок на основе IP.

Ввод

Перенаправления пути

Каждая строка: "<from-path> <to-url-or-path> [301|302]" — код состояния по умолчанию 301 (постоянный).

Миграция домена

Оставьте пустым, чтобы пропустить миграцию домена.

Контроль доступа по IP

Вывод

Созданный .htaccess
 
Это было полезно?

Другие способы использовать этот инструмент

REST API

curl -X POST https://api.iotools.cloud/v1/tool/htaccess-redirect-generator \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "redirectRules": "/old-page /new-page\n/promo https://example.com/l…"
  }'

Подставьте свой собственный ключ из аккаунта. Поля инструмента — это тело запроса, без обёртки.

Спросите у ИИ-агента

Use the IOTools `htaccess-redirect-generator` tool (.htaccess Redirect Generator) on this input:

YOUR_INPUT_HERE

Вставьте это любому агенту, подключённому к MCP-серверу IOTools, и добавьте свой ввод.

Виджет для встраивания

<iframe
  src="https://iotools.cloud/embed/htaccess-redirect-generator/"
  width="100%" height="520" frameborder="0" scrolling="no" loading="lazy"
  title="Генератор перенаправления .htaccess — iotools.cloud"
  sandbox="allow-scripts allow-forms allow-same-origin allow-downloads allow-popups allow-popups-to-escape-sandbox"
  allow="clipboard-write"
  style="width:100%;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden"></iframe>
<script src="https://iotools.cloud/embed.js" async></script>

Вставьте это на свою страницу — бесплатно, без ключа, нужна лишь обратная ссылка.

Стоимость вызова API/MCPОт 5 кредитов
Нужно больше кредитов?Посмотреть тарифы

Также доступно через

Руководства

The .htaccess Redirect Generator builds the Apache rules that .htaccess-rule-generator's toggle list doesn't cover: arbitrary path redirects, a whole-domain migration, and IP-based access control. Paste in a list of old→new paths, an old and new domain, or a list of IP addresses, and get a ready-to-paste, correctly-escaped .htaccess snippet.

What it generates

  • Path redirects — one Redirect 301 (or 302) directive per line you enter, using Apache's mod_alias Redirect directive rather than a rewrite rule, so it works even without mod_rewrite enabled.
  • Domain migration — a mod_rewrite block that 301-redirects an old domain (with or without www.) to a new one, preserving the request path.
  • IP access control — either an allow-list (<RequireAny> with Require ip) that blocks everyone except the listed addresses/ranges, or a deny-list (<RequireAll> with Require not ip) that blocks only the listed ones. Both use the Apache 2.4 mod_authz_core syntax, not the removed 2.2 Order/Deny/Allow directives.

Any section left empty is skipped — fill in only what you need.

How to use it

  1. List your path redirects, one per line: <from-path> <to-url-or-path> [301|302]. The status code defaults to 301 (permanent) if you leave it off.
  2. Optionally set an old and new domain to redirect an entire site to a new host.
  3. Optionally pick an IP access mode and list the addresses or CIDR ranges (e.g. 203.0.113.5 or 198.51.100.0/24) to allow or block.
  4. Copy the generated snippet, or download it as .htaccess, and upload it to your site's document root (or the specific directory you want it to govern).

Frequently asked questions

How is this different from the .htaccess Rule Generator? That tool covers site-wide toggles — force HTTPS, www canonicalization, hotlink protection, gzip, caching. This tool covers the things that need a per-case list: specific path redirects, a domain migration, and IP allow/deny lists. Use both together if you need everything.

Does Redirect need mod_rewrite? No — Redirect and RedirectMatch come from mod_alias, which is enabled on virtually every Apache install by default. The domain-migration block does need mod_rewrite, which is why it's wrapped in an <IfModule> guard.

Can I redirect an entire path prefix, not just one exact path? This generator matches exact paths only (Redirect performs a prefix match on the path you give it, so /old also matches /old/page, but it won't rewrite the rest of the URL). For pattern-based rewriting with capture groups, you'll need a hand-written RewriteRule.

Is my input sent anywhere? No. The snippet is generated entirely in your browser. Nothing you type is uploaded.

htaccessapache301 redirect302 redirectdomain migrationurl forwardingip blockip whitelistaccess controlmod_rewrite

Нравятся инструменты? Уберите рекламу.

Один платёж навсегда убирает всю рекламу с вашего аккаунта. Без подписки, без слежки.