Configure web.config file for PHP project in subdirectories

Asked

Viewed 1,226 times

1

I have a website on php in test phase in a directory above the root of the official website. To configure the friendly URL (remove the entension . php) is for web config.. I made a rule that doesn’t work for subdirectory files. Ex: products/something and product/something, only works in root type files php company.. When accessing product and product pages get the message "No input file specified."

http://www.exemplo.com.br/sitenovo/empresa = OK

http://www.exemplo.com.br/sitenovo/produtos/camisas = No input file specified.

With the php extension works normally: http://www.exemplo.com.br/sitenovo/produtos.php/camisas

1 answer

1


I managed to solve it this way: (With asterisks after bar)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="rule 1p" stopProcessing="true">
                    <match url="^([a-z0-9-]+)/*"  ignoreCase="true" />
                    <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="/sitenovo/{R:1}.php/*" appendQueryString="false" />
                </rule>

            </rules>



        </rewrite>
    </system.webServer>
</configuration>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.