A section of your site moves, and suddenly thirty old URLs need to point somewhere new. Typing thirty redirects by hand is slow and error-prone, so the natural hope is that a tool will take the folder name, wave a wildcard at it, and produce one clever rule that covers everything.

Sometimes that one rule is exactly right. Sometimes it is a trap. This guide is honest about what the free Redirect Rule Generator on Ovatly can and cannot do here, and walks through the two routes that work: one generated row per page, or one hand-written prefix line.

Contents

  • Quick answer
  • What "redirect a whole folder" really asks for
  • Why the generator will not write a pattern for you
  • Route 1: one row per page
  • Route 2: one hand-written prefix line
  • How to redirect a folder, step by step
  • Worked example: one row from a folder of shop pages
  • Limitations and honest tradeoffs
  • Common mistakes
  • FAQs
  • Conclusion
  • References

Quick answer

The Redirect Rule Generator works in exact from/to rows, one literal path per rule, and it escapes regex characters in a from path automatically. It will not invent a pattern or wildcard rule for you, and that is deliberate: a generated rule can never surprise you by matching more than the one path you typed. So a folder move has two honest routes. Route 1: enter one row per page and generate the set in your server's format. Route 2: when every page keeps its path under a new folder, write a single prefix line by hand in the same file, such as the splat form in a _redirects file. Either way, test after deploying, because the generator validates shape only.

What "redirect a whole folder" really asks for

Behind the one request sit two different situations. In the first, the folder's pages scatter: they land in different categories, a few are retired, one merges into a guide. No single pattern describes that, because each page has its own destination. In the second, the folder itself is renamed and everything inside keeps its relative path: /old-shop/soap becomes /shop/soap, and so on for every page.

The route follows from which situation you are in, not from the page count. Twenty pages that keep their paths are one prefix rule; six that scatter are six rows.

Why the generator will not write a pattern for you

Redirect rules are pattern-matching machinery, and a pattern slightly too broad can swallow pages you meant to keep. The generator takes the safe side of that trade: you enter a from path and a to path, and any character in the from path that would have a special meaning in a pattern is escaped, so the path is matched literally, character for character.

That makes generated rules predictable: read a set of them and you know exactly which URLs each one touches. The cost is what this guide is about: the tool will not compress a folder into one pattern, because compressing is where the unpredictability lives. The route 2 prefix line is short enough to write and review by hand, and you should review it: it is the one rule in the file that matches more than a single path.

Route 1: one row per page

Enter each old path and its new path as its own row, with its own status code (301, 302, 307 or 308). The generator refuses a duplicate from-path, which quietly protects you from giving the server two destinations for the same URL. Then pick your format: .htaccess, Nginx, or _redirects, and copy the whole set into place.

This route is the right call when the folder is small enough to list without regret, and the only correct call when pages land in different places, because each row carries its own destination and code. It is also easier to change later: one page's redirect is one readable line to delete.

Route 2: one hand-written prefix line

When every page keeps its path under a new folder, one line does the whole job. In a _redirects file, the splat form looks like this:

/old-shop/*  /shop/:splat  301

The Nginx equivalent is a single rewrite with a capture, and Apache takes a folder-level Redirect line. These forms are general knowledge rather than generator output, and that is the point: the generator's escaping behaviour means it would treat the * as a literal character, not a wildcard, so this line has to come from you. Keep it to one line, read it twice, and give exceptional pages their own exact rows as well.

How to redirect a folder, step by step

  1. List the folder's old URLs and decide where each one lands. If every destination is the same folder with the path preserved, you are in route 2 territory; otherwise plan rows.
  2. For route 1, open the Redirect Rule Generator and enter one from/to row per page, choosing each row's status code.
  3. Pick the output format that matches your server: .htaccess, Nginx or _redirects.
  4. For route 2, write the single prefix line by hand in that same format, alongside any generated rows.
  5. Deploy, then test: visit several old URLs, including any exceptions, and confirm each lands where you intended.

Worked example: one row from a folder of shop pages

Suppose /old-soap moves to /soap, and its neighbours scatter to different categories: a route 1 job. One row in the generator, from /old-soap to /soap with a permanent code, produces this Nginx line:

rewrite ^/old-soap$ /soap permanent;

The escaping policy is visible in it: the ^ and $ anchors pin the match to exactly that path, and nothing else on the site can be caught by it. Every other page gets its own row and line in the same style. Twelve scattered pages become twelve lines you can audit at a glance: not brevity, but rules you can trust because each says exactly what it does.

Limitations and honest tradeoffs

The generator will not produce pattern, wildcard or folder rules, full stop. If your move needs one prefix rule, that line is hand-written and hand-checked, and a mistake in it affects every URL under the folder: a wider blast radius than any single row can have.

The tool also validates the shape of your rules only. It cannot know whether your server read the file, whether another rule earlier in the file intercepts the same URL, or whether the destination page exists. In Nginx output, 307 and 308 rows are emitted as exact-match location blocks with a return line rather than simple rewrite lines, so a mixed set will not look uniform. Hence the final step is always the same: deploy, then click the old URLs yourself.

Common mistakes

  • Expecting the generator to invent a wildcard. It escapes special characters on purpose. The prefix line is yours to write.
  • Using a prefix rule when pages scatter. If some pages land outside the new folder, the prefix rule sends them to the wrong place. Give them rows.
  • Writing the prefix line too broadly. A splat on a short path can catch pages outside the folder. Anchor it to the full folder path.
  • Deploying without testing. Shape-valid rules can still be ignored by a server that never loaded the file. Test real URLs.

FAQs

Can the Redirect Rule Generator create a wildcard rule for a whole folder? No. You enter exact from/to rows, and regex characters in a from path are escaped automatically, so every generated rule matches one literal path. A folder-wide pattern is a single line you write by hand in the same file.

When is one row per page the better route? When the folder is small enough to list, or when its pages do not all land in the same place. Rows let each page point at its own destination and status code, which a single prefix rule cannot do.

When is a single prefix rule better? When every page in the old folder keeps the rest of its path under a new folder, so one rule can carry them all. If even a few pages break that pattern, give those pages their own rows as well.

Where does the hand-written prefix line go? In the same file as your generated rules: the _redirects file at the site root for Cloudflare Pages or Netlify, the .htaccess file for Apache, or your Nginx configuration.

How do I know the folder redirect works? Test it after deploying. The generator validates the shape of the rules only; it cannot confirm your server applied them. Visit a few old URLs and check each lands on the page you expect.

Conclusion

A folder redirect is either a list or a pattern, and the honest tool behaviour is to generate the list precisely and leave the pattern to you. Use the Redirect Rule Generator for one exact row per page when destinations differ, and write the single prefix line yourself when a folder truly moves as one. If the next question is which status code each row should carry, our comparison of 301 vs 302 for redirect rules works through the choice case by case. For more guides in this series, see our Website and Webmaster Tools guides.

References