WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Changing Permalinks Structure makes Library Images Disappear (6 posts)

  1. gagwithgaffer
    Member
    Posted 8 months ago #

    Hello,

    Yesterday I moved my website from one server to another, it was previously installed on a W7 virtual machine (Windows HyperV) running from server 2012 but I have now reinstalled the website onto a standalone W7 Pro machine.

    I basically did this to make the most of the computer hardware resources as my site was running a bit slow.

    Anyway, I now have the website re-installed on W7 using IIS 8 express and URL Rewrite Module 2. (using MySQL Community 5.6.24.0 and PHP 5.3.27)

    MY ISSUE: If I change the permalinks structure within the WP Admin Panel (under settings, permalinks) to anything other than the default setting then some of my images stored in my media library disappear, they basically show a small red cross instead of the image.

    For some reason, all images that were uploaded to the library before I migrated to the new W7 machine are all showing ok, it is only new images uploaded since reinstalling wordpress that are an issue.

    I wanted to change the permalink structure from the default 'http:mywebsite/?p=12'3 to 'http://mywebite/sample-post/'

    I have tested this 'http://mywebite/sample-post/' structure by creating a new post and seeing what url address I get in the browser address bar, the url address does change to the new structure so therefore I know that the URL rewrite module is technically working, however I need to find out why this structure is affecting the images in my library

    When I upload an image to the library and go back to the main media library page then the small thumbnail image from the images list is visible, if I then click on the image to bring up the editor page, it disappears. I also find the image is not visible in any post that it has been uploaded to.

    My web.config file has the following lines of code:

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
    <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"/>
    </conditions>
    <action type="Rewrite" url="index.php"/>
    </rule></rules>
    </rewrite>
    </system.webServer>
    </configuration>

    If I delete the web.config file from the wordpress installation folder then the issue goes away, but then none of my web pages are viewable as I will get browser error pages. Once I delete the web.config file, when I re-save the permalink structure then a new web.config file is automatically generated with the above code in, I assume this is normal practice.

    Please help with my issue, I've been trying to solve this for 3 days now and is doing my nut in!, thanks in advance :)

  2. gagwithgaffer
    Member
    Posted 8 months ago #

    UPDATE:

    I have tried loading a fresh instance of wordpress as a test website on the same W7 machine and have found the same issue with permalinks affecting the images in the library, this proves it is not an issue with the website as such but something to do with the way I have installed the windows components that run the website, could it be an issue with IIS 8 or URL Rewrite module configuration?

    Is there any config I should have done for URL Rewrite in IIS?

    Thanks

  3. gagwithgaffer
    Member
    Posted 8 months ago #

    UPDATE

    This is the strangest issue I have ever come across! If I go to the WordPress installation folder on my C Drive, right click and select the security tab, I then go into 'edit' and toggle any privilege rights of any user in the list (for example I toggle 'full control' or 'modify' for user group 'authenticated users' and then 'Apply' the changes and press 'OK' to close the window, I then go back to WordPress and open an image in my media library that was giving me problems before, refresh the web page by pressing F5 and then the image re-appears!

    Note: I've also discovered that I don't actually have to make a change in state of the security permissions, if I un tick an option, I then re-tick it before pressing ok to close the folder properties window. All I'm effectively doing is refreshing the security privileges for that particular folder.

    I have tried this on two different wordpress installations so I know it's not unique to one particular installation.

    What the **** is going on??? :(

  4. WPyogi
    Volunteer Moderator
    Posted 8 months ago #

  5. gagwithgaffer
    Member
    Posted 8 months ago #

    Hello,

    I have seen the above link and I am already using the URL Rewrite Module 2 as my website is installed on a Windows 7 machine using IIS 7.5

    I have discovered the issue arises from using wordpress 3.7 and upwards. I have been running tests using a fresh install of wordpress with no plugins installed. If I run the site on wordpress ver 3.6 then all is ok, as soon as I update wordpress to 3.7 or upwards then the permalink problems reappear.

    It seems quite a lot of other people are experiencing similar issues with permalink breakups. There is something in the wordpress core installation files that are causing the bug but I've no idea how to fix.

  6. gagwithgaffer
    Member
    Posted 8 months ago #

    ***RESOLVED***

    I found the following link which should be a fix for most people:

    http://stackoverflow.com/questions/4403514/wordpress-permalinks-on-iis

    also see link:

    http://www.howyoudo.info/index.php/how-to-fix-windows-server-upload-file-inherit-permissions-error/

    Basically when using wordpress on IIS7 platform, uploading images through wordpress are handled by php, the images are uploaded to a temporary directory before they are put into the contents/uploads folder in your main installation directory. The reason I was getting the above results was that I was trying to add security permissions to my contents/uploads folder thinking this would be the fix. As php uploads the images to a temporary directory first, they inherit the folder permissions from there so this temporary folder must have the same folder permissions applied as well, otherwise they will not carry across the right permissions to there final destination, hence the broken links showing.

    Please see the above link for further details, cheers

Reply

You must log in to post.

About this Topic