The MU forums have moved to WordPress.org

Whne inserting media, file URL gets rewritten to post (13 posts)

  1. clintlalonde
    Member
    Posted 13 years ago #

    I am running multiple sites and have a strange error that is occurring on 2 of the 14 sites on the server (the other 12 work as expected).

    When inserting media content into a Page, I choose "link to File URL" option. But when I save the page, the link gets rewritten to a Post URL link.

    This behavior occurs on these 2 sites in both FireFox and IE, tested on 2 different machines. It seems to apply mp3, pdf, and MS office documents (url's to images do not get rewritten). If I had code the link to the document (bypass the insert media option), the url does not get rewritten.

    All the sites are running the same plugins and themes, so I don't suspect a plugin or theme compatibility problem.

    Any advice would be much appreciated.

  2. andrea_r
    Moderator
    Posted 13 years ago #

    Okay, I have someone else with the exact same problem. thanks for the reminder I need to look at it. :D

  3. clintlalonde
    Member
    Posted 13 years ago #

    Doing some more troubleshooting on this.

    It appears when I insert a file from the media library into a page as a link, a rel attribute is added to the a href tag. Here is what the link looks like when I insert a pdf object using the Add media icon:

    <a href='http://path.to/username/files/2010/05/Unconferences.pdf' rel='attachment wp-att-33'>Unconferences</a>

    When I save this, the HTML code gets rewritten to:

    <a href='http://path.to/username/homepage/unconferences/' rel='attachment wp-att-33'>Unconferences</a>

    If I manually intervene and remove the rel attribute before I save, the link does not get rewritten and all is good.

    So, I am wondering what is the significance of the rel attribute?

  4. wpmuguru
    Member
    Posted 13 years ago #

    Compare permalink settings between the sites that are working and the ones that are not.

  5. clintlalonde
    Member
    Posted 13 years ago #

    Thanks wpmuguru. They all have the same permalink structures

    /%year%/%monthnum%/%day%/%postname%/

  6. clintlalonde
    Member
    Posted 13 years ago #

    Okay, I have more info (and beginning to suspect this might be a bigger issue as I am able to recreate in 3 separate instance of WPMU).

    This behavior only occurs on a page IF that page is set to be the static home page of the site.

    So, if anyone would like to try to recreate this to see if it happens for you, I'd appreciate it to confirm that this might be a reproduceable problem across multiple installs.

    • Upload a pdf document to the media library to use for testing
    • Create a new page
    • Set the page as the static home page for the site
    • Edit the page and insert the PDF document from the media library using a file URL (after doing this you might want to check the HTML code and see if it contains the rel attribute in the a tag. If it does, then I'll bet when you complete the next step you will get the same result I am experiencing).
    • Update the page
    • Preview the page and test the link.

    Now, what this should do is create a direct link to the PDF document. However, what we are experiencing is that at this point the link is getting rewritten to a post url link and going to an intermediary page.

    If the page is NOT made the static home page and you create a file url, this file url remains a file url and does not get rewritten.

    I would be very grateful if someone else was able to reproduce this.

  7. FrancoFrenette
    Member
    Posted 13 years ago #

    My opinion is that this is caused by a plugin. Try deactivating all plugins. It would be a plugin that is filtering post content, it's probably interfering here. Specially if it's looking for certain keyword strings like "files" or "conference" perhaps. There's plugin like linkadink and alinks (which seem to both be discontinued now) but that filtered content like this and created links automatically out of it so my guess is it's something like that or another plugin interfering.

  8. clintlalonde
    Member
    Posted 13 years ago #

    Thanks Franco.

    I deleted all the plugins from one of the installs I tested on (our dev server), and was able to recreate this problem. I also was able to recreate the problem on a fresh vanilla install of WPMU - no plugins or themes beyond the vanilla install. I don't think this is a plugin issue.

  9. clintlalonde
    Member
    Posted 13 years ago #

    I'll add these are 2.9.2 installs running on LAMP stacks. 2 instances are located on our institutional infastructure and the third (the new install I just did this morning to test this problem out) is located on a commercial hosting service.

  10. FrancoFrenette
    Member
    Posted 13 years ago #

    oh wow ok, no permalinks and no plugins causing it that is weird. Perhaps some htaccess rules outside the permalinks either on that site or server-wide?

  11. FrancoFrenette
    Member
    Posted 13 years ago #

    My initial reaction was some filtering with the wysiwyg / or how wpmu strips out code it doesn't like but I quickly dismissed that as I don't see why / how.. specially on fresh installs with no settings changed.

  12. clintlalonde
    Member
    Posted 13 years ago #

    Okay, I was just able to reproduce this on a standalone instance of WP (not MU) so this seems to be something that is not MU specific. I'm heading over to WP forums to see if I can find any info there. Would still be grateful if someone else would give it a shot to replicate this.

  13. clintlalonde
    Member
    Posted 13 years ago #

About this Topic

  • Started 13 years ago by clintlalonde
  • Latest reply from clintlalonde