0
votes

I have running Typo3 on server 2012R2 and IIS. On the same server also exchange is installed. Typo3 now creates clean URLs, but this URLs always creates a 404 error. I found a solution to solve this problem with

<system.webServer>
    <defaultDocument>
        <files>
            <add value="index.php" />
        </files>
    </defaultDocument>
    <rewrite>
        <rules>
            <rule name="SpeakingURL" enabled="false">
                <match url="(^(typo3|fileadmin|typo3temp|uploads)/|\.(php|js|css|jpg|png|gif|pdf)$)" negate="true" />
                <action type="Rewrite" url="index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

but than exchange is not working correctly anymore. So I have to look for a solution which detects only clean URLs.

Example: http;//www.myDomain.com/customers/name/location This URL I have to send to index.php.

There is no querystring in the url and no dot or any extension in the path. How can I build a rule for the IIS URL rewrite, that incomming clean URLs will be passed to index.php?

2
Since you have multiple applications on the same IIS server, make sure you analyze different URL patterns, so that you can use different rules with regular expressions to distinguish them. URL Rewrite also supports conditions (like Host header) which can simplify certain cases. Too broad to discuss without a more specific scenario.Lex Li

2 Answers

0
votes

Your problem are two kinds of virtual URLs.

I don't know much about exchange, but I know TYPO3.

In TYPO3 you have some few real folders for files like images, CSS, JS and all HTML is virtual. While you have exact pathes for the files only your virtual content is responsible for pathes to the HTML (virtual pages). That makes it difficult to give fix rules for rewrites.
In normal TYPO3 installations you have only those real files and the rest is virtual and handled by /index.php. But that only is valid if you use TYPO3 9 or the extension realurl (or the old simulatestatic). otherwise TYPO3 only uses index.php and handles the rest in URL parameter (e.g. ?id=124&L=2&type=98)

Solution:
disable realurl (con: no nice URLs)
or use the extension staticfilecache, which exports all CMS-pages as real files so no rewrite is necessary (con: no 'dynamic' content).

0
votes

It seems to be, that I found a solution for my problem. Up to now, it works fine for me. I have added the code below in the system.webServer section in the web.config file under wwwroot.

   <defaultDocument>
        <files>
            <add value="index.php" />
        </files>
    </defaultDocument>
    <rewrite>
        <rules>
            <clear />
            <rule name="Clean URL" enabled="true">
                <match url="(.*)" />
                <action type="Rewrite" url="index.php" />
                <conditions>
                   <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                   <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
               </conditions>
           </rule>
        </rules>
    </rewrite>

This is for Typo3 9,5+