Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
3.0k views
in Q2A Core by

Earlier there was a post asking if Q2A works on IIS with PHP installed.  There was a comment that read it works fine other than the url rewrite portion.

This works, but you have to create a custom web.config file for the directory where Q2A is installed.  It pretty much mimics the code that the htacess file would have on an apache server.

Below is the web.config file that needs to be placed in your Q2A directory.  Also make sure you have the first option selected for your url structure in your Q2A admin.

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Question2Answer" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{URL}" pattern="^(.*)//(.*)$" ignoreCase="false" />
                    </conditions>
                    <action type="Redirect" url="{C:1}/{C:2}" redirectType="Permanent" />
                </rule>
                <rule name="Question2Answer2" stopProcessing="true">
                    <match url="^.*$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?qa-rewrite={R:0}&amp;{QUERY_STRING}" appendQueryString="false" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>
 

 

by
Allas, this causes server 500 errors for my IIS7 configuration running on Windows 2008R2.  What IIS / server configuration were you using that this worked on?
by
Caused a crash because this REQUIRES the Query Rewrite module be installed to your IIS... http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/

3 Answers

0 votes
by

When i choose first option selected for url structure i get:

11111The page cannot be found

Anybody knew what problem it could be?

by
I get the same error "The page cannot be found", how do you fix this??
0 votes
by
Bravo!!!Thanks for your tip and code, i really need it. Slove my problem one and for all. thanks (^_^)
by
reshown by
Excellent that solved my problem as well...learned programming now
0 votes
by
It seams that this does not work with german Umlaute:

Ä, ö, ü ...
by
I have same proplem. How to fix it?
...