Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
You cannot enable Apache’s mod_rewrite on IIS. IIS uses Microsoft’s URL Rewrite Module for equivalent rewrite and redirect rules. Install the module on the IIS server, then create rules in IIS Manager or the site’s web.config; installing it alone does not configure your application’s URLs.
What replaces mod_rewrite on IIS?
mod_rewrite is an Apache HTTP Server module. The IIS counterpart is Microsoft IIS URL Rewrite Module 2.1, which provides regular-expression matching, conditions, rewrite maps, redirects, and an IIS Manager interface. Microsoft lists it for IIS 7, 7.5, 8, 8.5, and 10; consult the official download page for the listed compatibility and x86/x64 installers.
Apache .htaccess rules cannot simply be pasted into IIS web.config. IIS uses different rule syntax, configuration scope, path matching, and server variables. URL Rewrite includes an interface for importing Apache rules, but review and test imported rules because not every directive, flag, or per-directory behavior has a direct equivalent.
A rewrite changes the resource IIS processes internally while the browser usually keeps the requested URL. A redirect sends a response telling the browser to request a different URL, so the address changes. Use the right action for the job.
#1 Best Overall
- Easily store and access 2TB to content on the go with the Seagate Portable Drive, a USB external hard drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
Before you install
- IIS must already be installed and serving the site.
- You need administrator rights to install a server module.
- Choose the installer architecture matching the operating system: x86 or x64.
- Install the module on the IIS server that hosts the site, not just on a separate development computer.
- Back up the site’s
web.configbefore editing it. - If the site is on shared hosting, ask the provider whether URL Rewrite is installed and enabled. You may not have permission to add server modules.
URL Rewrite does not install PHP, configure FastCGI, or make an application compatible with IIS. Those are separate requirements.
Install IIS URL Rewrite
- Open Microsoft’s IIS URL Rewrite download page.
- Download the URL Rewrite 2.1 installer that matches the server’s architecture.
- Run the installer as an administrator and accept the installation options.
- If IIS Manager was open, close and reopen it.
- In IIS Manager, select the server or target website and look for URL Rewrite in Feature View.
The Web Platform Installer (WebPI), often recommended in older instructions, was retired on December 31, 2022. Use the standalone installer linked from Microsoft’s URL Rewrite page instead; see the WebPI retirement notice.
Installing the module makes its engine and management feature available. It does not automatically create rules for a particular website.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Verify the module is available
In IIS Manager, select the server or site, open Feature View, and check for URL Rewrite. Open it; the Rewrite Rules pane should load. If the feature is missing, confirm that the installer completed on this machine, that you selected the right architecture, and that IIS Manager was restarted. If you manage a remote server, check the remote server itself; on hosted services, ask the provider to enable the feature.
As an administrator, you can also inspect registered IIS modules from Command Prompt:
Rank #2
- Easily store and access 5TB of content on the go with the Seagate portable drive, a USB external hard Drive
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
%windir%system32inetsrvappcmd.exe list modules
Use this as a diagnostic, not a substitute for checking the target server and site in IIS Manager. The displayed module name can vary with registration details.
Create a rule in IIS Manager
- Open IIS Manager and select the target website.
- In Feature View, open URL Rewrite.
- In the Actions pane, choose Add Rule(s)…, then select Blank rule.
- Enter a rule name and configure the match pattern.
- Add conditions if the rule should apply only to certain requests.
- Choose the action, such as Rewrite or Redirect.
- Apply the rule and test the URL.
A rule consists of a name, a match pattern, optional conditions, and an action. For details on the fields and workflow, see Microsoft’s rule-creation walkthrough.
Example: Rewrite a friendly URL
This site-level example sends a path such as article/342 to an application endpoint while leaving the friendly URL in the browser:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite article URL" stopProcessing="true">
<match url="^article/([0-9]+)/?$" />
<action type="Rewrite"
url="article.aspx?id={R:1}"
appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
^article/([0-9]+)/?$matchesarticle/342andarticle/342/. In a site-rootweb.config, the match pattern is typically written without a leading slash.([0-9]+)captures the digits;{R:1}inserts capture group 1 into the destination.type="Rewrite"routes internally rather than asking the browser to navigate elsewhere.appendQueryString="true"preserves the incoming query string.stopProcessing="true"stops later rules from processing the request after this rule matches. It is often similar in purpose to Apache’s[L], but not a universal one-to-one translation.
Place application-specific rules in the site’s root web.config unless the application requires another scope. Add a <rewrite> section to the existing file rather than replacing the whole file.
Common Apache front-controller conversion
A typical Apache rule routes requests that are not real files or directories to index.php:
Rank #3
- Easily store and access 1TB to content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop. Reformatting may be required for Mac
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
The comparable IIS intent can be expressed like this:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →<rule name="Front Controller" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
The file and directory conditions allow existing static assets and directories to be served instead of sending every request to the front controller. This is a generic pattern, not a universal configuration for every PHP framework. Use the framework’s recommended IIS configuration when available, and make sure the application, PHP runtime, and FastCGI are configured separately.
The rough translation is: Apache RewriteCond becomes IIS <conditions>; RewriteRule becomes <rule>, <match>, and <action>; Apache $1 rule captures become IIS {R:1}; and %{REQUEST_FILENAME} becomes {REQUEST_FILENAME}. Apache’s RewriteEngine On usually has no direct per-site equivalent in IIS once the module is installed. Treat this as a translation of intent, not a character-for-character conversion.
Redirect instead of rewrite
Use a redirect when the client should move to a different URL. For example, a permanent redirect action can look like this:
<action type="Redirect"
url="https://www.example.com{REQUEST_URI}"
redirectType="Permanent"
appendQueryString="true" />
Replace the example host with the real destination. A permanent redirect communicates that a URL has moved; test it carefully because clients may cache it. Use a temporary redirect while checking a new rule.
Rank #4
- Easily store and access 4TB of content on the go with the Seagate Portable Drive, a USB external hard drive.Specific uses: Personal
- Designed to work with Windows or Mac computers, this external hard drive makes backup a snap just drag and drop
- To get set up, connect the portable hard drive to a computer for automatic recognition no software required
- This USB drive provides plug and play simplicity with the included 18 inch USB 3.0 cable
- The available storage capacity may vary.
For HTTPS enforcement and canonical-host rules, keep conditions narrow and test them independently. A combined example might be:
<rule name="Redirect to canonical HTTPS host" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAny">
<add input="{HTTPS}" pattern="^OFF$" />
<add input="{HTTP_HOST}" pattern="^www.example.com$" negate="true" />
</conditions>
<action type="Redirect"
url="https://example.com/{R:1}"
redirectType="Permanent"
appendQueryString="true" />
</rule>
Replace example.com with your hostname and confirm that a valid TLS certificate is in place first. If IIS sits behind a reverse proxy or load balancer, {HTTPS} may reflect the connection from the proxy to IIS rather than the client’s HTTPS connection. That can cause redirect loops; trusted proxy headers and appropriate server configuration may be necessary. Separate, narrowly scoped rules can be easier to diagnose than a combined rule.
Rule scope and where rules live
Site-level rules are commonly stored in web.config; global rules are stored in IIS’s applicationHost.config. Global rules operate server-wide and are evaluated before distributed rules. Distributed rules are evaluated in the configuration context where they are defined: a rule in a subdirectory’s web.config does not necessarily see the same match path as one at the site root. See Microsoft’s explanation of global and distributed rules and the configuration reference.
For most applications, keep application-specific rules in the site-root web.config. Reserve global rules for administrator-managed server-wide policies, such as centralized host handling. Back up configuration before changing it.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallTest the rule and diagnose failures
Test more than the one URL that motivated the change:
Best Value
- [Upgraded Version] - This external hard drive features a mirrored logo stripe combined with a striped anti-slip design, and the rounded corners of the casing make it easier to grip. The stripes also have a heat dissipation function, ensuring stable and fast data transfer.
- 【Ultra-thin and quiet】 - The motherboard adopts JMicron 578 noise-free solution, giving you a quiet working environment. Lightweight and portable size designed to fit in your pocket for easy portability.
- 【Ultra-Fast Data Transfers】 - Pairing this external hard drive with JMicron 578 solution USB 3.0 and USB 2.0 interfaces enables blazing-fast data transfer. It boasts theoretical read speeds of up to 125MB/s and write speeds of up to 103MB/s.
- 【Plug and Play】 - With no software to install, just plug it in and the drive is ready to use.The hard disk chip is wrapped with an aluminum anti-interference layer to increase heat dissipation and protect data.
- 【What You Get】 - 1 x Portable Hard Drive, 1 x USB 3.0 Cable, 1 x User Manual, Gift-type shell packaging ,Three-year manufacturer's warranty and free technical support services.
- Request the friendly path and confirm the application returns the expected response.
- For an internal rewrite, confirm the browser address remains the friendly path.
- Try a real static file and a real directory to ensure they still work.
- Try an unknown route and check the application’s expected not-found behavior.
- Test a request with a query string and verify it reaches the application.
- If the pattern allows both slash variants, test both.
- Inspect the response status, redirect
Locationheader when applicable, and IIS logs. Test from another client if diagnosing network or proxy behavior.
URL Rewrite is missing in IIS Manager
Check that installation completed on the server you are managing, restart IIS Manager, verify the installer architecture, and confirm the hosting provider has enabled the module if you do not control the server.
HTTP 500.19 after editing web.config
This commonly indicates malformed XML, a duplicate or misplaced configuration section, a locked setting, or a missing module that cannot handle the <rewrite> section. Restore the backed-up file if necessary, validate the XML, verify the module, and add the rule back in a minimal form. Read the detailed IIS error substatus and configuration line number; on shared hosting, the provider may need to unlock or enable the section.
The rule does not match
Check the rule’s configuration scope and whether the match pattern should include a leading slash (site-level distributed rules are commonly matched relative to their configuration directory). Verify conditions, URL encoding, whether the request maps to an existing file or directory, and whether an earlier rule stopped processing.
Recommended Free Tools
Redirect loop
Check whether the rule redirects to a URL that still meets its own conditions, whether host and HTTPS rules conflict, and whether a proxy terminates TLS before forwarding to IIS. Test one rule at a time, use a temporary redirect during diagnosis, and inspect each Location header.
Static files fail or query strings disappear
A catch-all front-controller rule should generally exclude existing files and directories. To preserve incoming query parameters, set appendQueryString="true" and check that the target URL is not replacing them. Test rather than assume the result.
It works locally but not in production
Confirm URL Rewrite is installed on production IIS, compare site roots and subapplication paths, check whether configuration overrides are allowed, and account for differences in proxy headers and HTTPS termination.
When ARR is needed
Application Request Routing (ARR) is for reverse-proxy and related routing or load-balancing scenarios, such as forwarding requests to another application server. It is not required for ordinary site rewrites or front-controller rules. ARR is a separate module that depends on URL Rewrite; install URL Rewrite first, then add ARR only if the design needs proxy features. See Microsoft’s ARR download page and ARR overview.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Deployment checklist
- URL Rewrite is installed on the IIS server hosting the site.
- The module appears in IIS Manager for the correct server or site.
- The rule is in the intended configuration scope and uses IIS syntax.
- Existing files, directories, query strings, and unknown routes behave as expected.
- Redirects have been checked for loops, correct host, and HTTPS behavior.
- The production server and hosting configuration have been verified.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

