Heine

  • home
  • drupal
  • drupal core commits
  • about
Home › Drupal

Drupal clean URLs on IIS 7

Heine — Thu, 16/10/2008 - 09:57

To get Clean URLs working on IIS 7, install the new URL rewriter module (x86, x64) and add the following to the system.webServer section of the sites' web.config:

<rewrite>
  <rules>
    <rule name="Drupal clean URLs" enabled="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />    
        <add input="{REQUEST_URI}" negate="true" pattern="/favicon.ico$" />
      </conditions>
      <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>

You also need to install a hotfix to correct REQUEST_URI behaviour when using PHP via the FastCGI module. See KB954946 for more information. A symptom of this problem is when all form submissions get redirected to the frontpage of the site.

Update: You may want to look into the Microsoft Web Platform, which contains an installer for Acquia Drupal.

Average: 4 (5 votes)
  • Drupal
  • IIS

Awesome help! However, where do I add that code to.

Cheatah (not verified) — Fri, 27/03/2009 - 17:48

Where do I add the code? Do I need to create a web.config file in the directory?

  • reply

Nevermind Figured it out.

Cheatah (not verified) — Fri, 27/03/2009 - 17:52

You can just create a web.config from scratch and put the following info:

<?xml version="1.0" encoding="utf-8" ?>

  • reply

Configuration tag

Heine — Thu, 21/05/2009 - 09:14

If you later try to configure your site, IIS complains loudly when there's no configuration tag. Use the following template to prevent this.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
    </system.webServer>
</configuration>

The rewrite block then goes inside the system.webServer section.

  • reply

wha.. where?

n00b (not verified) — Thu, 13/08/2009 - 05:10

for clarification...

The web.config file sits in the site's root directory?

  • reply

The initial web.config file

n00b (not verified) — Thu, 13/08/2009 - 05:13

The initial web.config file for an application must be placed in the root directory of the web application. Sub-directories within the web application can contain their own web.config files to control individual configuration settings appropriate to the given sub-directory.

Google be my guide.

  • reply

And a good guide it is

Heine — Thu, 13/08/2009 - 13:30

And a good guide it is :)

Thanks for posting back.

  • reply

Post new comment

I reserve the right to edit any comment submitted to the site. If your comment contains flaming, advertisements, or simply too many spelling errors (leet speak), it may never appear.
The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <as>, <as3>, <csharp>, <diff>, <drupal5>, <drupal6>, <html>, <js>, <mysql>, <php>, <phpbrief>, <python>, <sql>, <plain>, <xml>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

Recent posts

  • Upgraded from 6.14 to 6.15, but Drupal still thinks it's 6.14?
  • Google Friendconnect Drupal module not recommended (yet)
  • The OpenID 2.0 Compliance Crusade - Part I
  • Using <embed> for XSS
  • Bugfix woes for Drupal 6
more

Security reviews

  • Afraid custom code makes your site vulnerable?
  • You don't really trust that module you just downloaded from Drupal.org?

Sleep better after a security review.

Tags

Captcha CSRF DOH! Drupal embed Input Format modx OpenID Performance Planet Drupal Security Varnish
more tags
  • home
  • drupal
  • drupal core commits
  • about

Copyright © 2010 by Heine Deelstra. All rights reserved.