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

(This post was last modified: 02-12-2016, 01:17 AM by pratikgaikwad69.)

hi all,

we have created one site in codeigniter. original site is on main domain and we created one sub_domain for our testing purpose  and we have created an android app for site.

but right now we are facing some problem so i need your help.

1) we have released our android app and forgot to point that app to main domain so all data coming from app get saved in sub domains db and images in uploads folder of sub domain.

now we are working on to release a forced updated of android app but till then is there any solution to move images from sub domain to main domain.

i have changed sub domains database name  as main_db so information get saved to db  but how to move that images to main domain file structure  is their any way ???
Reply
#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
#3

thanx Diederik
Reply




Theme © iAndrew 2016 - Forum software by © MyBB