Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok so here is my final solution. Everything works and follows my expectations (I added the fact that I didn't want to see the /public in the URL).</p> <p>Read the code comments for a better understanding.</p> <pre><code>&lt;!-- Rewrite rules --&gt; &lt;!-- Below is some rules in order to have a beautiful URL on the client side. + Each requests to a /public/something urls are transferred to a /something url + If the /public/requestFile exists we serve it + If the requested file exists we serve it + If no other rules has matched then we send the request to our public/index.php file (default behavior from Zend Framework 2) --&gt; &lt;rewrite&gt; &lt;rules&gt; &lt;!-- Permanent redirect of requests on /public/something to /something --&gt; &lt;rule name="Redirect public " stopProcessing="true"&gt; &lt;match url="^public/(.*)$" ignoreCase="false" /&gt; &lt;action type="Redirect" redirectType="Permanent" url="/{R:1}" /&gt; &lt;/rule&gt; &lt;!-- If the file/directory requested exist in /public, we serve it. --&gt; &lt;rule name="Search in public" stopProcessing="true"&gt; &lt;match url="^(.*)$" ignoreCase="false" /&gt; &lt;conditions logicalGrouping="MatchAny"&gt; &lt;add input="{DOCUMENT_ROOT}/public{URL}" matchType="IsFile" ignoreCase="false" /&gt; &lt;add input="{DOCUMENT_ROOT}/public{URL}" matchType="IsDirectory" ignoeCase="false" /&gt; &lt;/conditions&gt; &lt;action type="Rewrite" url="/public/{R:1}" /&gt; &lt;/rule&gt; &lt;!-- If the file/directory requested exist, we serve it. --&gt; &lt;rule name="Direct files" stopProcessing="true"&gt; &lt;match url="^.*$" /&gt; &lt;conditions logicalGrouping="MatchAny"&gt; &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="true" /&gt; &lt;add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="true" /&gt; &lt;/conditions&gt; &lt;action type="None" /&gt; &lt;/rule&gt; &lt;!-- If no previous rules have matched, then we send the request to public/index (url rewriting used by Zend --&gt; &lt;rule name="Url rewriting" stopProcessing="true"&gt; &lt;match url="^.*$" /&gt; &lt;conditions&gt; &lt;add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /&gt; &lt;/conditions&gt; &lt;action type="Rewrite" url="public/index.php" /&gt; &lt;/rule&gt; &lt;/rules&gt; &lt;/rewrite&gt; </code></pre> <p>Thanks to <strong>Ruben</strong> for the help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload