I am working on fixing a website.
Images don't show up unless the url starts with www
For example when you try to access this image http://example.com/wp-content/uploads/2013/11/VictorMoreTrimed.jpg
, it redirects you to the home page.
With the www
in front, it shows up.
I tried to edit the .htaccess
file to redirect the whole website to the www
version:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^example.com [nc]
rewriterule ^(.*)$ http://www.example.com [r=301,nc]
But it still not working.
Can anyone help please ?
Since you provided your entire htaccess, we can try inserting some lines to force www
on all your pages.
#DirectoryIndex
index.php
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Insert here to force www
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# End of forcing www
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Reference: