When my application throws an error it is properly showing the error pages as defined in my config/main.php. This is working as long as the URL starts with www.<mydomain>.com/index.php/ and anything which is within this URL throws the proper error message. E.g. https://www.<mydomain>.com/index.php/something throws an error since there is nothing to resolve "something".
My config/main.php looks like this.
However, if I have a URL looking like this:
https://www.<mydomain>.com/something -> This will show the default error pages used by IIS
http://www.<mydomain>.com/something -> This will show the default error pages used by IIS
Can I configure Yii in a way to include these paths too, or do I have to actually replace the default error pages used by IIS for these cases?
but in the case of www.domain.com/somethinginvalidornot your server seeks for a folder except if you have another setting as it is described below
Yii framework (by your application) manipulates that by .htaccess. The default Yii code of this file is
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
Maybe in your server this file has not affect, did you check this issue?
I created a .htaccess file now with the code above and imported it in the “URL Rewrite” feature of IIS7.5. The rule has been created and applied, but it has only an effect on the first URL, so one step closer
How can I get the second URL covered (the one without https).
In addition to my comment above, I should add that I have disallowed usage of http on my site, so that when you try to go to a URL with http://something then it shows a 403 error message. This is not covered by either the URL rewrite rule or the Yii default configuration of error pages.
So my issue remain with URL’s which start with http:// instead of https:// . The first URL was solved by the rewrite rule suggested above, but not the second one.
I solved it by redirecting the servers default error 403-page to https://mysite . Maybe not the best solution, but since it only covers the root if someone types the URL incorrectly without HTTPS it should be enough for my case. That solved my second URL.
I think it would be nice if you combine some wiki on server configurations of IIS … I mean, how to re-interpret the .htaccess settings generally used in Yii for Apache.