Support » Fixing WordPress » pretty permalinks for attachments using htaccess

  • Hi everyone I have been having trouble moving my WordPress installation to a new server. After the transfer I have everything re-enabled, unfortunately pretty permalinks for all of my media attachments seems to broken.

    Regular post permalinks are now working fine but all of my images are not visible in posts. When accessing images via the dashboard they have the URL

    Here are some more details:

    Using version: 3.4.1
    Permalink settings: /%postname%/
    Uploads directory structure: /wp-content/uploads/year/month/file.*

    Now I am trying to get my media attachment permalinks to resemble the uploads directory as seen below.*

    I also have the following in my .htaccess file. Need a rewrite rule to make this work, please help!

    Options -Indexes
    Options +FollowSymLinks
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    # END WordPress

    Thanks again everyone!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Still need some help please.

    A site link may help…

    Also please explain:

    Uploads directory structure: /wp-content/uploads/year/month/file.*

    The site is in maintenance mode as things are broken. The directory listed is where my uploads are stored.

    I need a rewrite rule to redirect from:


    Only for media/images/attatchments.

    May I ask why? Might it not be best to fix the database?

    I would like things to remain as they were before the transfer. If I edit the database I would need to seek out the attatchment ID for every single image. A single rewrite rule seems simpler.

    I do not want media appearing as

    I want to see the file name.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘pretty permalinks for attachments using htaccess’ is closed to new replies.