Redirect directory and contents using htaccess

How to redirect an entire directory and all internal files using the htaccess file.

In the example below the site moved from a standard static page website to a site powered by WordPress, and thus moved its images directory as shown below:

(note: In WordPress, change your media settings by un-checking this box “Organize my uploads into month- and year-based folders”. This will keep all your uploads in a single folder.)

RewriteEngine On
RewriteRule ^images/(.*)$$1 [L]


  1. trau says

    hi! very congratulation for this blog! very interesting! :)
    i have a question about this post..

    I would use your code for redirect my images into my WP blog from folder wp-contet/uploads to bucket in s3 of amazon and so another domain with same sub folder (importa same sub folder)



    this is my htaccess:

    RewriteEngine On
    RewriteRule ^/wp-content/uploads/(.*)$$1 [L]

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

    But redirect image to s3 dont work :((
    PS pubblic url of image in s3 is good in a new browser :)

    where i wrong?
    sorry my bad english :)

    can you help me with rule in htaccess please?? :))
    thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

 characters available

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>