Forums

Permalinks messing up static URLs to images (7 posts)

  1. tinker123
    Member
    Posted 1 year ago #

    Hi;

    I recently changed my permalinks to a custom structure:
    http://mydomain.org/category/postname

    Using this string in the "Custom" field under Settings | Permalinks
    /%category%/%postname%/

    It works great.

    However in some WordPress Pages on my blog I have a number of images I point with static links going to my server space

    For example:
    http://myblogdomain.org/img/rdmdeng.jpg

    When I use custom permalinks none of these images appear on the WordPress Pages/Posts. When I switch back to the default permalinks the images appear.

    What is going on?

    Is there anyway I can switch to the custom permalink format without messing up these images?

    Thanks in advance

  2. songdogtech
    Member
    Posted 1 year ago #

    Changing permalinks won't automatically change any old static URLs you have to non-wordpress URLs in content. That's far beyond what permalinks do and how they work by mod rewrite.

    Use something like Search RegEx to search and replace through all posts and pages to fix old URLs, and move the images into /wp-content/uploads/ for future-proofing.

  3. tinker123
    Member
    Posted 1 year ago #

    I used relative paths to my img directory in my image tags, ie:

    ../../img/rdmdeng.jpg

    Without custom permalinks this is an example of an image URL
    http://myblogdomain.org/img/rdmdeng.jpg

    With custom permalinks turned on, the system inserts "blog" into the final URL to the img, braking it:

    http://bundergroundrailroad.org/blog/img/rdmdeng.jpg

    I have between 5 - 100 images, before I do search and replace.....and QC do you know for sure there isn't a way to get wordpress not to stick that blog/ into my img URLs?

    Is there anything special about the wp-content directory?

    Thanks in advance

  4. songdogtech
    Member
    Posted 1 year ago #

    You could move wordpress to root and as a result get rid of the /blog/ and then your links will work. It's best to stay with the standard wordpress directories, but not required.

  5. tinker123
    Member
    Posted 1 year ago #

    How would I move wordpress to root?

    Create a new blog in root, export my existing blog and import it into the new blog?

  6. songdogtech
    Member
    Posted 1 year ago #

  7. tinker123
    Member
    Posted 1 year ago #

    I decided not to move the blog.

    I figured out that if I moved the images directory to where the permalinks was munging the links to be I would only have to fix the image URLS in 13 "pages" versus 13 "pages" + 50 "posts".

    Thanks much for the help.

    I really like that search and replace plugin!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.