Heine

  • home
  • drupal
  • 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.3 (7 votes)
  • Drupal
  • IIS
  • Login to post comments

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?

  • Login to post comments

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" ?>

  • Login to post comments

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.

  • Login to post comments

wha.. where?

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

for clarification...

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

  • Login to post comments

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.

  • Login to post comments

And a good guide it is

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

And a good guide it is :)

Thanks for posting back.

  • Login to post comments

I don't know if that was

ThomasR (not verified) — Thu, 08/04/2010 - 16:10

I don't know if that was already the case before, but you just need to install the rewrite module and import the Drupal .htaccess file...

  • Login to post comments

That did not work in 2008

Heine — Sun, 11/04/2010 - 15:53

That did not work in 2008 :)

Glad to hear it has improved.

  • Login to post comments

Perfect!! =)

Otto (not verified) — Sat, 10/07/2010 - 16:43

Thank you! The tags you mentioned above worked perfectly on my Windows Server 2008 64bits Drupal installation.

  • Login to post comments

Recent posts

  • In doubt? Read the specs!
  • About the Webform SA
  • Psalmen voor Altblokfluit
  • Unserializing user-supplied data, a bad idea
  • Planet Drupal past and current
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

bladmuziek blood donation blood supply CSRF Drupal Input Format modx MSM Performance Planet Drupal Security Varnish
more tags
  • home
  • drupal
  • about

Copyright © 2011 by Heine Deelstra. All rights reserved.