WordPress.org

Ready to get started?Download WordPress

Forums

Custom Permalinks hides all PNG's but not JPG's (3 posts)

  1. raystclair
    Member
    Posted 3 years ago #

    Hello All

    Here is my issue - this has had me banging my head against the wall for months now.

    initially I had an issue with setting permalink structures in sites - it just hung the darn sites on a 404 error - anyway today I resolved that by updating the rules in the web.config file and for most of my sites its worked fine. - They now have nice friendly URL's and the pics all show up.

    Great!

    But there is one site that has me stumped - http://www.wisebuyspain.com

    I set the permalink structure to /%category%/%postname%/ - and this works - the URL's are nice and friendly and MOST of the images are there.

    "MOST" Being the operative term!

    It seems that the site is now allowing the .JPG files to show but NOT the .PNG files (and we need some PNG's in there for various reasons).

    For example if you look at the BLOG on the site and scroll down you will see that most of the images are there ... then they start to appear missing!

    Also all the images on the SideBar widgets are not there;

    However, if I set the permalink structure back to the default they all reappear again!

    In trying to solve this issue (been on it 6 hours now) I have done the following:

    1. Set the web.config file to read:-

    <?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>

    This works beautifully on my other sites. On this site it fixed the friendly URL issue for me.

    2. Set the .htaccess file (in the root of the site) to read as follows:-

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    (this didn't work)

    3. I then thought is might be a "literal pathing" issue and tried setting some of the paths from:-

    http://www.spanishpropertybuyer.com/wp-content/uploads/2011/06/wisebuyspain-spanish-property-social-icon-twitter.jpg

    to

    /wp-content/uploads/2011/06/wisebuyspain-spanish-property-social-icon-twitter.jpg

    (this didn't work)

    4. I even thought it might just be the .PNG files affected so I took 4 of the PNG's and made new .JPG's the same and uploaded them as new files and changed the file extensions in the HREF tag that called the image from .png to .jpg

    (this didn't work)

    so ...

    I AM COMPLETELY AND UTTERLY AT A LOSS!

    Please, if anyone has a clue of how I can resolve this I would be eternally grateful.

    Many thanks

    Ray

    PS: After three hours of Googling and Reading and trying different things it seems I am not the only one with this issue - WP need to put a fix in place if they can!

  2. raystclair
    Member
    Posted 3 years ago #

    C'mon ... please someone help - another three hours and I am still no nearer an answer.

    PLEASE!

    Ray

  3. raystclair
    Member
    Posted 3 years ago #

    RESOLVED!!!!

    SIX SODDING HOURS!!!

    So the fix is a combination of things ...

    1. The .htaccess file in the root of your worpdress site containing the code above.

    2. The web.config file in the root of your wordpress site containing the code above.

    Now this is where it gets complex:-

    3. Its to do with IIS Permission and PHP.ini and inherited permissions - let me explain ...

    When you upload a file to your wordpress sie PHP first of all copies it the TEMP folder defined by PHP.ini (usually c:\windows\temp or similar)

    Generally there are no write/modify permissions set on the temp folder.

    So when PHP then "moves" the file from the TEMP folder to your uploads folder (i.e. /wp-content/uploads) it moves it with no permissions on it.

    So to fix this ...

    A) Ensure that you have points 1 & 2 correct

    B) OPen up PHP.ini and look for the line that looks like - "upload_tmp_dir="C:\WINDOWS\Temp" (yours may specify a different directory)

    C) Now open windows Explorer and locate the folder specified in that line.

    D) Right click on that folder click "properties"

    E) then click the SECURITY TAB

    F) Now check if it has IIS_USRS showing in the "group or user names" section.

    F) If YES then

    i) highlight the IIS_USRS
    ii) clik the EdIT button
    iii) now select the IIS_USRS user again
    iv) in the permissions section check all the ALLOW tcikboxes
    v) Click APPLY
    vi) Then Click OK

    G) If NO (i.e there is no IIS_USRS then

    i) Click the EDIT Button
    ii) Click ADD
    iii) Type IIS_URSR into the field
    iv) Click CHECK NAMES and it should validate
    v) Click OK
    vi) NOW COMPLETE THE STEPS IN "F" above!

    This then adds the IIS_USRS group and sets the permissions for the OLD temp folder.

    H) Create a NEW folder OUTSIDE of your web folders (i.e. C:\MySites\UploadTemp\)

    I) Go back to the PHP.ini thats open in your text editor

    J) Change the line from "upload_tmp_dir="C:\WINDOWS\Temp" to "upload_tmp_dir="C:\MySites\UploadTemp\" (or whatever path and name you chose.

    K) Save the the changes to the PHP.ini

    L) Now open windows Explorer and locate your new folder

    M) REPEAT steps shown in "G" above then seps in "F" above (in that order)

    N) Now locate the /wp-contents/ folder in your wordpress site

    O) REPEAT steps shown in "G" above then seps in "F" above (in that order)

    OK - so that sorts the issue for any new files (PNG or JPG) that you upload and so this is the FIX.

    However we now have to deal with the OLD images as these still will not display.

    So ...

    1. find the post or page with the old image thats not displaying

    2. Remove it from the page/post

    3. USE FTP to copy all the images back to your PC

    4. Delete all the images that are not displaying from the server

    5. Delete any references to the old images in the Media Library

    6. Set the PERMALINKS to default.

    7. Set the PERMALINKS to your CUSTOM PERMALINKS again

    8. Re-upload the images to the Media Library

    9. Add them back into your post/page

    10. Refresh ... et Voila!

    All PNG and All other images now displaying beautifully in all pages and post WITH PRETTY PAGE URLS!!!

    This problem has killed me for the last few months and there has been no cohesive answer from anyone - WordPress blame your hosting (or in my case my dedicated server) the hosting companies blame Worpdress or PHP and you go round in circles.

    I am glad to have been able to "join the dots" of the myriad different threads of information that ARE out there into a single answer that I know works.

    I hope you all find this useful.

    Ray

    PS - Apologies for spelling/grammar errors - I type at 120 words a minute with 0% Accuracy!

Topic Closed

This topic has been closed to new replies.

About this Topic