Welcome Guest, Not a member yet? Register   Sign In
how to move images from sub domain to main domain
#2

Depending on your hosting platform you could make sub.domain.com an alias of www.domain.com inside your virtual host config in Apache. That way both domains will point to the same folder on the disk. So www.domain.com/images/test.jpg is the same file as http://sub.domain.com/images/test.jpg
Code:
<VirtualHost IPADDRESS>
   DocumentRoot "/path/to/public_html"
   ServerName www.domain.com
   ServerAlias sub.domain.com
</VirtualHost>

If you dont have access to the apache config and the sub domain point to a different folder on disk you could just create a .htaccess file inside the sub domain webfolder to redirect all trafic to the main domain
Code:
RewriteCond %{HTTP_HOST} !www.domain.com [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,QSA]
This way http://sub.domain.com/images/test.jpg wil serve a 301 redirect to www.domain.com/images/test.jpg
Reply


Messages In This Thread
RE: how to move images to sub domain to main domain - by Diederik - 02-12-2016, 01:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB