mardi 30 août 2016

How to Rewrite URL in web.config file to hide index.php in url like http://ift.tt/2bP69Kj?

I have a Laravel app hosted on a .net panel, which works fine if installed in the root. But I have to use it inside of two sub-directories after root, i.e. it's installed in root/dir1/dir2/app. Now below is my current code in the web.config file which works fine if the app is installed directly in the root directory:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Move to index.php">
                    <match url=".*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php/{R:0}" logRewrittenUrl="true" />
                </rule>
            </rules>
        </rewrite>
         <httpProtocol>
            <customHeaders>
                <add name="X-UA-Compatible" value="IE=11" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>
</configuration>

So, currently, http://ift.tt/2cp9FzS works, but I need it to be like http://ift.tt/2bP7QqM , is it possible? If so, please explain your answer as much as possible. Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire