.htaccess redirect tester
One wrong RewriteCond can send a whole site into a redirect loop. Paste the rules and a few URLs and see where each one ends up before the file goes live.
Your data stays in your browser. Nothing is uploaded or stored.
How to use it: .htaccess redirect tester
- Paste the rules from your .htaccess (RewriteEngine On and the redirect lines).
- Paste the URLs to test, one per line: old pages, http and www variants, URLs with parameters.
- Leave Follow redirects on to see chains on the same host.
- Click Test rules and read the result for each URL.
- Fix chains and loops, then test again and download the CSV for your records.
Key facts
- In .htaccess, RewriteRule matches the path without the leading slash.
- A RewriteRule without the R flag rewrites internally; with R it sends a redirect, 302 unless a code is given.
- Without a ? in the substitution the original query string is kept; QSA appends it, QSD drops it.
- Google follows up to 10 redirect hops, but each extra hop delays crawling, so point old URLs straight to the final address.
Where to get the data
Rules
RewriteEngine, RewriteBase, RewriteCond, RewriteRule, Redirect, RedirectPermanent, RedirectTemp and RedirectMatch. Other directives are skipped.
URLs
Full addresses or paths. A path such as /old/ is tested on example.com.
File checks
Conditions such as -f and -d depend on the server's files. Choose whether the tester should treat the requested file as existing.
Order matters
Rewrite rules run top to bottom. A broad rule placed before a specific one catches its URLs first. Put specific redirects first and general ones (https, www) in a way that sends each URL to its final address in one hop.
Don't mix mod_alias and mod_rewrite
Redirect and RewriteRule are handled by different modules and don't follow the order of lines in the file. Use one of them for the same URLs.
What the simulation can't know
The tester doesn't see your server config, other .htaccess files in subfolders, environment variables or the file system. Test on a staging server too and check live URLs with a redirect checker after deploying.
Next step
After deploying the rules, follow the post-migration SEO checklist so nothing gets lost.
Questions and answers
Why is my rule ignored?
Common reasons: RewriteEngine On is missing, the pattern starts with / (in .htaccess the leading slash is removed), or an earlier rule with the L flag already handled the URL.
301 or 302?
Use 301 (or 308) for permanent moves. Without a code, R sends a 302, which tells Google the move is temporary.
Does it support Nginx?
No, only Apache syntax. The redirect map generator writes Nginx rules from a list of old and new URLs.
Is my file uploaded?
No. The rules and URLs are processed in your browser.
Sources
- mod_rewrite — Apache HTTP Server documentation: https://httpd.apache.org/docs/2.4/mod/mod_rewrite.html
- RewriteRule flags — Apache HTTP Server documentation: https://httpd.apache.org/docs/2.4/rewrite/flags.html
- mod_alias — Apache HTTP Server documentation: https://httpd.apache.org/docs/2.4/mod/mod_alias.html
- Redirects and Google Search — Google Search Central: https://developers.google.com/search/docs/crawling-indexing/301-redirects