For reasons outside of my control, I need to get a Laravel instance running as a subdirectory of WordPress inside IIS 10. I've tried every conceivable option inside my web.config <system.webServer><rewrite><rules />
configuration, but I can only ever get one or the other working. If I leave the rewrite rule in for WordPress, Laravel doesn't work (WordPress responds with a 404) and if I disable the WordPress rule, Laravel works but obviously WordPress does not.
Here is the config at the root of the site (where WordPress sits):
<rewrite>
<rules>
<rule name="WordPress" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<!-- Laravel App -->
<add input="{REQUEST_URI}" pattern="^/laravel" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
Thanks to an SO search, I came across this (IIS Url Rewrite not working with nested WP installs) which had me put a nested web.config inside the subfolder for the Laravel app with the following:
<rewrite>
<rules>
<clear />
<rule name="Imported Rule 2" stopProcessing="true">
<match url="/(.*)$" ignoreCase="false" />
<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="public/index.php/{R:1}" />
</rule>
</rules>
</rewrite>
Oddly enough, with these it almost works - as long as I go to http://ift.tt/2vXbQix, all the associated views work and everything plays nicely together. I just can't seem to get the /public off of the URL, which obviously isn't usable.
Any tips? I'm certain it's close but I just can't figure it out.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire