Can anyone convert this web.config to .htaccess?

962 Views Asked by At

I need the following web.config file to execute in an Apache server. This is the web.config file of the OSTicket system.

Or anyone can lead me to a copy?

Thanks in advance!

<system.webServer>
    <directoryBrowse enabled="false" />
    <rewrite>
        <rules>
            <rule name="HTTP api" stopProcessing="true">
                <match url="^(.*/)?api/(.*)$" ignoreCase="true"/>
                <conditions>
                    <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="{R:1}api/http.php/{R:2}"/>
            </rule>
            <rule name="Site pages" stopProcessing="true">
                <match url="^(.*/)?pages/(.*)$" ignoreCase="true"/>
                <conditions>
                    <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="{R:1}pages/index.php/{R:2}"/>
            </rule>
        </rules>
    </rewrite>
    <defaultDocument>
        <files>
            <remove value="index.php" />
            <add value="index.php" />
        </files>
    </defaultDocument>
</system.webServer>
1

There are 1 best solutions below

0
On

Try:

DirectoryIndex index.php

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*/)?api/(.*)$ /$1api/http.php/$1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*/)?pages/(.*)$ /$1pages/index.php/$1 [L]