Forums

[resolved] 301 redirect "non-www to www" works fine but not with the Uploads folder (4 posts)

  1. eggroup
    Member
    Posted 9 months ago #

    Hi,

    I just noticed today that all my WordPress pages, posts, etc.. redirects non-www to www just fine except the Uploads folders. My Uploads folder called "files" so for example :

    mywebsite.com/files/image.jpg doesn't redirect to http://www.mywebsite.com/files/image.jpg

    Is this the default WordPress behavior for the Uploads folder or Am I missing something?

    Thank you so much for your help

  2. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 9 months ago #

    WordPress can only redirect the files it controls, which excludes images. You need to use a htaccess redirect for the images.

  3. eggroup
    Member
    Posted 9 months ago #

    OK, thank you. I added a 301 redirect to my .htaccess file and it's working like I want it now. I just wanted to make sure so I don't mess things up.

    Here is the 301 redirect non-www to www incase somebody needed.

    RewriteCond %{HTTP_HOST} ^mywebsite.com
    RewriteRule (.*) http://www.mywebsite.com/$1 [R=301,L]

    PS: I placed it after "# END WordPress" in my .htaccess file.

    Thanks again for your help.

  4. Ipstenu
    Half-Elf Support Rogue & Mod
    Posted 9 months ago #

    Move that to ABOVE #BEGIN WordPress for best results on site speed, actually :D

Reply

You must log in to post.

About this Topic