Home (All Topics) → Technology → Software → AI-Created Software
Shows what Apache would do with each URL under your .htaccess file, without sending a single request to your site: which URLs a firewall rule blocks, which are redirected and where to, which are rewritten to another page, and the error page a visitor would see. Use it before uploading a new .htaccess, to check that your real pages still work, your redirects land where you meant, and the probes you expect to be blocked are. Write down what each URL should get, and every run checks it for you.

Needs Python 3.8 or later. The window needs Tkinter (python.org installers include it; on Debian and Ubuntu, sudo apt install python3-tk). Nothing else is needed; on Linux and macOS, Pillow (pip install pillow) gives the window the app’s own icon instead of Tk’s.
python htaccess-rule-simulator.py
Choose the .htaccess file at the top (type its path or click Browse…), then fill in one or more of the four sources of URLs below it.
They all stay filled in, and the round button beside each one picks the source a run uses; clicking in a source’s field or its Browse… picks it too. Click Simulate (or press F5, Ctrl+R, or Enter in a field):
# are skipped), or a CSV file with a column of URLs, url unless you name another in CSV column. Each URL can say what it should get (see Checking expected results).images/2026/bed.jpg under https://www.example.com becomes https://www.example.com/images/2026/bed.jpg. This works with Cryptomator and other virtual drives.Under Server, two optional fields:
RewriteCond %{REQUEST_FILENAME} !-f are answered, a folder asked for without its slash is redirected to it, a folder’s index file is found, and a missing page is a 404. Without it, a rule that tests files gives NOT TESTED, and a URL nothing changes is listed as served as asked.curl/8.5 or a bot’s name to see what your rules do with it.The fields, the source and the window’s layout are remembered for next time.
Each URL gets one of seven results, the ones needing a look first:
[F] (403 Forbidden), [G] or a Redirect gone (410 Gone), or another error status.% escape or a path that climbs above the site’s root (/../), 404 for an encoded slash (%2F) or %00 in the path./index.php; Goes to shows it.A redirect on the site (the same host, with or without www.) is followed as a browser follows it, up to 10 redirects: Hops counts them and Ends at says where the visitor lands (200 OK at https://..., an error, another site), or Loop: back to ... when the redirects go round in a circle.
A chain of two or more is worth shortening: each redirect costs the visitor a round trip, and search engines may not follow long chains.
For every error, Error page says what the visitor sees: the page, text or URL of the .htaccess’s ErrorDocument for that status, or Apache’s own page (always Apache’s own for REJECTED, which happens before the .htaccess is read). A local error page is requested again inside the server and goes through the .htaccess like any URL.
When a rule blocks it or it is missing, the visitor gets Apache’s own page with a note that the error page failed, and the steps show why.
Section names the part of the file the deciding rule is in, from its # BEGIN WordPress or # 8G:[REQUEST URI] comment, beside its line and the line of the condition that matched.
Select a row to see its steps below the table: each rule that applied, each round, each redirect followed, the error page, and what Apache served. Beside them, the .htaccess file shows the rule that decided, its conditions marked and the condition that matched in bold.
Rules that no URL in the run triggered are dimmed there and listed under Rules: candidates for cleanup, or a sign that your URL list misses a case. Drag the dividers to give either more room.
The URL goes through the file as Apache 2.4 with its default settings takes it:
%xx escapes in the path are decoded, // becomes /, and /./ and /../ are resolved before the rules test the path, while the query string is tested exactly as sent. So /wp-config.php%2Ebak is blocked as .bak, and ?q=eval%28 isn’t blocked by a rule looking for eval(.[OR] conditions stops at the first that holds). [C], [S], [N], [L], [END], [QSA], [QSD] and [NE] work as in Apache, and a rewritten URL goes through the file again, as Apache’s internal redirect does, up to 10 times.The bar above the table counts each result. Click a heading to sort by it, and again to reverse. Right-click a heading to filter: Result, Status, Check, Expected, User agent, Agent type, Hops, Error page, Section, the line numbers, the pattern and the details list their values to check; URL, Goes to, Ends at, Path served and Query string take a text to search for. Clear filters shows every row again. Right-click a row to copy its URL or the whole row.
Check “Test each URL with the user agents checked in the list” under Server, and each URL is simulated once for each user agent checked, a row each, with the user agent’s name and type in their own columns.
Click User agents… to see the list. Each entry shows:
The defaults cover the common browsers on Windows, Mac, iPhone and Android, the main search engines (Googlebot, Bingbot, DuckDuckBot, Applebot, YandexBot, Baiduspider), the major AI crawlers (OpenAI’s, Anthropic’s, Perplexity’s, Amazon’s, Meta’s and Common Crawl’s), social preview bots and an uptime monitor, all expected to be allowed; tools (curl, Wget, Python, Go, Perl) and security scanners (sqlmap, Nikto, Nmap, masscan, WPScan, Nuclei, zgrab), expected to be blocked; and two SEO crawlers and an empty user agent, not checked.
Click in the Test column (or press Space) to check or uncheck an entry. Select one to see it below the table: a default’s expected result can be changed; fill in the fields and click Add as new for your own entry, which you can change (Save changes) or remove later. Restore defaults checks every default again with its first expectation. Check all and Check none do what they say. The list is saved as you change it, in user-agents.json in the working folder.
Each row’s Check then shows whether the user agent got what it should: a FAIL on a scanner means it slips through your rules, a FAIL on a browser or crawler means your rules block a visitor you want. The URL list’s own expected results aren’t used in this mode.
Write what each URL should get after it in a TXT list, or in a column named expected in a CSV list, and every run checks it:
https://www.example.com/wp-config.php DENIED 403
http://www.example.com/about/ REDIRECTED 301 https://www.example.com/about/
https://www.example.com/ REWRITTEN /index.php
https://www.example.com/shop/ UNCHANGED
An expectation is any of a result (DENIED, REDIRECTED, NOT TESTED and so on), a status (301) and where the URL goes (a URL, or a path for a rewrite), in any order and case. A redirect passes when its first target or the end of its chain matches. Check shows PASS or FAIL, failed checks come first in bold, the steps end with what differed, and the counts say how many passed. Use a list like this as a test to run after every edit.
Check “Write the results to a CSV file” and choose where it goes; each run then writes every result (not only the rows a filter shows), blocked first, with its steps on one line. The file opens in Excel as it is: UTF-8, a heading line, and a value that Excel would take for a formula kept as text.
--show-window FALSE runs the simulation without the window. It prints each URL that needs a look (denied, rejected, in error, not tested, failing its check, or redirected in a chain, a loop or to an error; every URL with --print-results all), with what decided it, where it goes and the error page, then the rules no URL triggered and the counts:
$ python htaccess-rule-simulator.py --show-window FALSE --htaccess-file-path .htaccess --input-file-path urls.txt --site-folder-path site
DENIED https://www.example.com/wp-config.php
403 Forbidden from rule line 36 (8G:[REQUEST URI]), condition line 34: (/)(wp-config\.php|xmlrpc\.php|\.git|\.env)
Error page: /errors/403.html (ErrorDocument line 4), with status 403.
REJECTED https://www.example.com/files/report%2Fq3.pdf
404 Not Found. Apache refuses the request before the .htaccess runs: an encoded slash (%2F) or NUL (%00) in the path.
Error page: Apache's default page: Not Found. The requested URL was not found on this server.
...
REDIRECTED http://example.com/garden-tips/
301 Moved Permanently from rule line 16 (Force https and www), condition line 14: off
Goes to https://www.example.com/garden-tips/
Ends after 2 redirects: 200 OK at https://www.example.com/blog/
Not triggered by any URL: ErrorDocument line 5; RewriteRule line 42.
Simulated 27 URLs. DENIED: 10 | REJECTED: 2 | ERROR: 1 | REDIRECTED: 5 | REWRITTEN: 7 | NOT TESTED: 0 | UNCHANGED: 2 | Expected: 5 passed, 1 failed
With --test-user-agents TRUE, each line names the user agent too (DENIED https://... as curl (tool or library)).
With --test-url, the URL’s result is printed whatever it is. The exit status is 0 when the simulation ran (whatever it found), 1 when it couldn’t (a missing file, nothing to simulate in the .htaccess, no URLs), and 2 for a mistake on the command line.
Every option takes a value, as --name VALUE or --name=VALUE, in any order. Without --show-window FALSE, the window opens with every option given filled in, even several sources at once: the first one given is picked, and you sort out the rest there. It simulates at once when the .htaccess file and exactly one complete source are given. In the console, give one source; more than one is a mistake.
--working-folder-path FOLDER: where the settings file goes (blank: the script’s folder).--htaccess-file-path FILE: the .htaccess file at the site’s root (blank: in the window, the one used last time).--test-url URL: a single URL to simulate.--input-file-path FILE: a TXT or CSV file of URLs, each with its expected result if you like.--csv-column NAME: the column of URLs in a CSV input file, in any case (blank: url).--sitemap-url URL: a sitemap or sitemap index.--base-url URL and --local-folder-path FOLDER: a site’s address and a folder whose files become URLs.--site-folder-path FOLDER: a copy of the site’s files, for file tests and missing pages (blank: none).--user-agent TEXT: the browser’s user agent, as the rules see it (blank: Chrome on Windows).--test-user-agents TRUE or FALSE: simulate each URL with each user agent checked in the list, kept in user-agents.json in the working folder (the default is FALSE: one user agent). It can’t go with --user-agent.--print-results problems or all: in the console, print only the URLs that need a look (the default), or every URL.--csv-file-path FILE: write every result to this CSV file (blank: no CSV file).--show-window TRUE or FALSE: open the window (the default), or simulate in the console.
| Key | Action |
|---|---|
| F5, Ctrl+R | Simulate the URLs |
| Enter in a field | Simulate the URLs |
| Ctrl+C in the table | Copy the selected rows’ URLs |
| F1 | About htaccess Rule Simulator: its version and links to its page |
<Files>, <If> and similar sections is left out, with a warning under Rules; what is inside <IfModule> is read.REMOTE_ADDR) give NOT TESTED. Headers come from a browser: the user agent you choose, no referrer and no cookies.Version 1.4.0, updated 2026-11-28. infolific.com: https://infolific.com/technology/software-worth-using/ai-created/htaccess-rule-simulator/

