Htaccess / Nginx Redirect Tester

Test .htaccess RewriteRule and Nginx rewrite directives against a URL. See the redirect chain, detect common mistakes, and convert rules between Apache, Nginx, and Caddy formats.

Redirect Chain

Final:
No rules matched - URL passes through unchanged.

Convert Format

How to use the Redirect Tester

Paste your redirect rules (Apache .htaccess, Nginx, or Caddy format), enter a test URL, and click Test to see the full redirect chain - each hop is shown with its HTTP status code and the matching rule. Use the Format Converter to translate rules between web server formats.

301 vs 302: which to use?

301 Moved Permanently tells browsers and search engines that a URL has moved for good - the old URL's SEO equity transfers to the new one, and browsers cache the redirect. Use 301 for permanent URL restructuring, domain migrations, or removing trailing slashes. 302 Found is a temporary redirect - SEO equity stays on the original URL. Use 302 for maintenance pages, A/B testing, or redirects that may change. 307 Temporary Redirect behaves like 302 but preserves the HTTP method (POST stays POST).

Redirects in Laravel

In Laravel, redirects are handled at the application level in routes or controllers - avoiding the need for server-level config for most use cases. Use return redirect()->to('/new-path', 301) for permanent redirects, or return redirect()->route('route.name') for named routes. For bulk URL redirects you can use a redirect_rules database table and a wildcard route that looks up the current path.

Caddy redirects

Caddy uses a simple redir directive in the Caddyfile: redir /old /new 301. Wildcards and placeholders work too: redir /blog/* /posts/{path} 301. Unlike Apache and Nginx, Caddy requires no RewriteEngine On or regex - the syntax is straightforward and readable.

Related tools