Broken permalinks in IIS - how to fix?

Hi there,

I've got something really wierd happening in my media library.

I'm using a child theme for business-feature. On a windows server IIS7.

When I upload a picture into the media library - it uploads OK, and produces a URL for the image.
Once its uploaded though, I can't see the image thumbnail in the media list, and when I put the image into a post it doesn't show.

Very Wierdly though I can click into the image to edit it and I can see it.

Has anyone any ideas? I've uploaded some screen grabs that I thought might help.


  • roobarb

    Hiya Phil,

    I've just spent the day doing investiagtions, and I think I've just found the source of the problem - but not how to get around it. So I'm hoping you can help!

    There is a heap of threads about this issue out there on the WP forums, but no real solutions.

    Ok - here is what I did.

    I turned off everything - themes, plugins the lot and emptied the media library. Then did a series of tests uploading via the flash uploader, and via the browswer uploader. Some images got uploaded and thumbnails showed correctly - and some didn;t. Some images even though they were then uploaded correctly and in the library OK still wouldn't show on the posts - and others did. There was absolutly no pattern with file type, size or anything like that. Very bizare.

    So in a final attempt I undid the permalinks changed back to default - and removed the web.config file. And voila - media library works again!

    So it is obviously to do with the permalinks.

    When I tried to change them origionaly I got a wordpress screen up that said it couldn;t automatically cahnge them, and I needed to create a WP_config file which I did, and obviously this is whats caused the issues.

    So the question now is, how to change the permalinks without breaking the media library.

    This is what is in it now.

    				<rule name="wordpress" patternSyntax="Wildcard">
    					<match url="*" />
    							<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    							<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    					<action type="Rewrite" url="index.php" />

    As I said before I'm on a windows IIS7 server (not my choice) and I am assuming this might be something to do with the rewrite issues.

    I'm not a coder, and don't really understand why this is doing what it is - but after hours of testing this is where it all comes back to.

    Do you have any ideas how to get permalinks working again? I can;t be left without the media library working, but can;t also leave the permalinks as they are. Bit catch 22

    Thanks in advance

  • Aaron

    You'll need to rewrite rules for uploads handling:

    <rule name="Imported Rule 1" stopProcessing="true">
    <match url="^(.*/)?files/$" ignoreCase="false" />
    <action type="Rewrite" url="index.php" />
    <rule name="Imported Rule 2" stopProcessing="true">
    <match url="^(.*/)?files/(.*)" ignoreCase="false" />
    <add input="{URL}" pattern=".*wp-content/plugins.*" ignoreCase="false" negate="true" />
    <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />

  • roobarb

    Hi there,

    Sorry I've not replied earlier - thanks for the updates.

    Aaron, I've not manaully set-up multisites - but am using the business feature theme which might already have something in the backend. But I don;t see any NETWORK link in the admin area as I would expect if thats the case.

    Can you please advise if the code above for the rewrite rules is still valid if its not a multi-user site?

    If so, can you tell me where I need to put it - I must admit this whole windows server bit is just tooooo scary for me!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.