Windows server: Edit Profile Image displays broken link

Windows server: Edit Profile Image displays broken link

by Fred Weiss -
Number of replies: 4

When upload image to a users profile all that results is a broken link.  It was suggested in another forum that this could be related to slash arguments.

Server / HTTP

When slash arguments are set to the Default ie Yes than the image can be viewed.

However, on our server slash arguments is set to No (box checeked) as this is the only way IMS imported content can display images.  If we turn slash arguments to the default of yes all of the images in the IMS imported content display as broken links.

ISAPIrewrite.dll is installed.

We are using Windows 2003, IIS 6.0, PHP 5.2.6, Moodle 1.9.4+, 

Average of ratings: -
In reply to Fred Weiss

Re: Windows server: Edit Profile Image displays broken link

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers

You need to enable URL Rewriting. What rule are you using with ISAPIrewrite?

See the bottom section of this page for some basic details:
http://docs.moodle.org/en/Installation_for_Windows_2003_with_IIS

And then do this if you can't get ISAPIrewrite to work:

  1. Download ISAPI_Rewrite from http://www.isapirewrite.com/. The ISAPI_Rewrite Lite version works fine.
  2. Install it by running the .msi file that you downloaded.
  3. Open the httpd.ini file in the directory that you installed it to. The default is: C:\Program Files\Helicon\ISAPI_Rewrite\
  4. httpd.ini contains this default rule:
         [ISAPI_Rewrite]
         # Defend your computer from some worm attacks

         RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]
  5. Add these rules:
         RewriteRule (.*?\.php)(\/.+) $1\?file=$2 [N,I]
         RewriteRule ^([^\?]+?\.php)(\/.+)$ $1\?file=$2 [QSA]
  6. Restart IIS.

Your profile images should now display correctly regardless of whether slash arguments is enabled or not. At least, it worked for me on Windows 2003, IIS6, PHP 5.2.8 and Moodle 1.9.4+

More info here: http://moodle.org/mod/forum/discuss.php?d=16569

In reply to Luis de Vasconcelos

Re: Windows server: Edit Profile Image displays broken link

by Fred Weiss -

Thanks very much these rules seem to have fixed the problem.

Both my IMS and profile images are displaying correctly.   Probably need to do a little more testing but so far all looks good.

Thanks again.

In reply to Luis de Vasconcelos

Re: Windows server: Edit Profile Image displays broken link

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers

Please note: the httpd.ini file is only used by version 2 of ISAPI_Rewrite Lite. ISAPI_Rewrite Lite version 3 uses a slightly different method - the ISAPI_Rewrite Manager (but it's just as easy). The rules are stored in the httpd.conf file.

In reply to Luis de Vasconcelos

Re: Windows server: Edit Profile Image displays broken link

by Gisele Brugger -

Can we help-me?

Reluctantly had to migrate to a windows server with IIS7.

But any image stored on moodledata can't  display, but all other files are displayed.

In IIS7, from what I read, the configuration file will be stored in dirroot with name web.config  with rules to URL Rewriting.

how to turn this rule to the web.config ?

RewriteRule (.*?\.php)(\/.+) $1\?file=$2 [N,I]
RewriteRule ^([^\?]+?\.php)(\/.+)$ $1\?file=$2 [QSA]

 

see too: http://moodle.org/mod/forum/discuss.php?d=80548

http://moodle.org/mod/forum/discuss.php?d=123467

rules in IIS7 : http://www.iis.net/download/urlrewrite

URL Rewriting with PHP and IIS 7

http://www.phpgenious.com/2010/04/url-rewriting-with-php-and-iis-7/

 

Thank you all