Heine

  • drupal
  • drupal core commits
  • about
Home

Drupal clean URLs on IIS 7

Submitted by Heine on Thu, 16/10/2008 - 08: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.

Submitted by Cheatah (not verified) on Fri, 27/03/2009 - 16:48.

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

  • reply

Nevermind Figured it out.

Submitted by Cheatah (not verified) on Fri, 27/03/2009 - 16: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

Submitted by Heine on Thu, 21/05/2009 - 08: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

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>, <csharp>, <diff>, <drupal5>, <drupal6>, <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

To combat spam, please enter the code in the image.

Advertisements

Recent posts

  • Menu access, a new pitfall when going back to Drupal 5
  • Drupal 6: $base_path doesn't always point to the frontpage
  • XNA SoundEffect ContentLoadException
  • A new form element in Drupal core
  • The backstabbing March-Hare

All-time popular content

  • Update UID 1 password via JS
  • Keeping an eye on Drupal core
  • Subversion on Strato V-PowerServer
  • A new form element in Drupal core
  • Access denied - Are you sure?
more

Tags

Captcha Coding Drupal FAPI IIS Let's hope it doesn't become popular Performance PHP Planet Drupal Quiz Security V-PowerServer
more tags
  • drupal
  • drupal core commits
  • about

Copyright © 2009 by Heine Deelstra. All rights reserved.