Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9121047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:46:16+00:00 2026-06-17T05:46:16+00:00

I’ve been looking over many examples but just can’t get my head around this,

  • 0

I’ve been looking over many examples but just can’t get my head around this, may be it isn’t possible. I’ve inherited a mess of a WordPress site.

I have this DIR structure, WordPress:

/wp-content/uploads/
/wp-content/uploads/2011
/wp-content/uploads/2012
/wp-content/uploads/Organised
/wp-content/uploads/Organised/0-9
/wp-content/uploads/Organised/A
/wp-content/uploads/Organised/B
/wp-content/uploads/Organised/ and so on ... to Z

Basically there were over 93,000 files in the /wp-content/uploads/ folder, and some in the 2011, and 2012 folders. I need to move the 93,000 files so decided to make the “Organised” folder with folders in there reflecting the first letter/number of potential files.

While this isn’t an issue, with moving them that is, I need to make sure external requests can still access those files based on the old URL.

So:

/wp-content/uploads/APicture.jpg

Will Rewrite to:

/wp-content/uploads/Organised/A/APicture.jpg

While still allowing access to actual URLS like:

/wp-content/uploads/2012/AnotherPicture.jpg

I thought a Rewrite URL like this would work but it doesn’t and I have tried many variations, maybe it just can’t work like this?

RewriteRule ^/wp-content/uploads/([^/]+)(\.png|\.jpg|\.bmp|\.gif)$ /wp-content/Organised/T/$1$2

Note: For testing I was checking a URL /wp-content/uploads/taylor-swift-harry-styles.jpg such is why I hardcoded the resulting rewrite URL but I realise it needs to be changes to match the initial letter.

Thanks for all your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:46:17+00:00Added an answer on June 17, 2026 at 5:46 am

    You may try this:

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !wp-content/Organised   [NC]
    RewriteCond %{REQUEST_URI} wp-content/uploads/(\w)([^/]+)\.(png|jpg|bmp|gif)/? [NC]
    RewriteRule .*   wp-content/Organised/%1/%1%2.%3    [L]
    

    It will redirect URLs like this one:

    http://example.com/wp-content/uploads/Taylor-swift-harry-styles.jpg

    But not like this one:

    http://example.com/wp-content/uploads/2012/Taylor-swift-harry-styles.jpg

    To:

    http://example.com/wp-content/Organised/T/Taylor-swift-harry-styles.jpg

    Where directory T is the first character of the file name. It can be a single digit or a single letter.

    It will keep the letter case, though. For example, if the letter is in lower case, the mapped directory will be t and must exist. Same happens when the letter is in upper case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to count how many characters a certain string has in PHP, but
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.