I have a web.config file with the following text, although not relevant to my problem...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Pretty URL">
<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="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Normally when I develop on my Windows machine the folder with my PHP source has permissions for all authenticated users and pretty URLs in my Yii2 website works without any issues.
Now, my next project requires me to deploy on a Windows machine where non-admin users will also use and I tested deploying a Yii2 website to a folder that gives IUSR user the ability to List, Read, & Execute files.
The website works, but the pretty url does not.
If I copy the folder contents to another location with regular authenticated user and SYSTEM permissions, it works as expected.
I think I am missing some permissions that will enable pretty URL to work properly with IIS7 URL Rewrite module, but not sure what.
The Microsoft® URL Rewrite Module for Internet Information Services 7 (IIS 7) and above provides flexible rules-based rewrite engine that can be used to perform broad spectrum of URL manipulation tasks, including, but not limited to: Enabling user-friendly and search engine-friendly URLs with dynamic Web applications.
Set the ‘Matching Scope’ to ‘Response’ in the dropdown, make sure that all the items within the ‘Match Content Within’ dropdown are deselected – this will mean URL Rewrite will scan the entire response not just specific tags. Select ‘Matches the Pattern’ in the ‘Content’ dropdown and ‘Regular Expressions’ in the ‘Using’ dropdown.
Sep 10 2019 03:06 AM This is the third part of the article series dealing with IIS using URL rewrite as a reverse proxy for real world apps. Check out part 1 and part 2 before reading on.
For example, if a substitution URL in a rewrite rule is " /folder1/folder2 ", and these folders exist on file system and have default document configured, then DefaultDocument module redirects a Web client to " /folder1/folder2/ ", thus exposing the rewritten URL.
In Linux it's quite common that servers run as special user.
I apply this habit even in Windows and it's easy to configure access then for the server.
User accounts shouldn't matter then related to the server.
Ownership of all files in the web-directory has to be then the user of the web-server, i.e. "IUSR".
The user as which the server is running has to be adjusted in IIS configuration if it differs from "IUSR" which is the default IIS-user.
Only for file-access related to editing some adjustments might be required for all files but if the server is running as a user it's also clearer that file-access for editing and for server-access are two different purposes. So you even can adjust edit-access to limited files for users, while the server has full access to all files. Giving different access-rights to different users or usergroups is also no problem.
For more details about the default IIS-user you can read Understanding Built-In User and Group Accounts in IIS 7
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With