Reputation: 1471
I have the following two WordPress sites.
The uploads(images) folder is on mysite.com and I want all image URLs from test.mysite.com to be redirected to mysite.com
For example the link test.mysite.com/wp-content/uploads/2015/09/image.jpg
should be redirected to mysite.com/wp-content/uploads/2015/09/image.jpg
I appreciate any help.
Upvotes: 0
Views: 107
Reputation: 732
If you care about your website traffic and SEO. I would recommend using 301 redirection which is: RedirectMatch permanent
It's quite easy! Make an new .htaccess file at test.mysite.com > Just add this chunk of codes bellow:
RewriteEngine On
RedirectMatch permanent ^/wp-content/uploads/(.*)$ http://mysites.com/wp-content/uploads/$1
Now all images Should be 301 SEO redirected to the concerned location.
Upvotes: 2
Reputation: 785266
You can place this redirect rule just below RewriteBase
line:
RewriteCond %{HTTP_HOST} ^test\.(mysite\.com)$ [NC]
RewriteRule ^(wp-content/uploads/.+)$ http://%1/$1 [L,NC,R=301]
Upvotes: 1