How to change to subdomain
Posted: Tue Sep 27, 2011 4:18 pm
After searching the forum last night and not finding a post laying this out step by step and having to rely again on Simon's patience and a bit of fiddling (think he was asleep by that time) I decided this morning to post this step by step guide if you install the shop to a sub domain, but like me forget to point it in the right url in the first place. It is pretty easy to do as long as care is taken and you double check your spelling.
First there are 3 files you need to get from the server to change a very small amount of code, don't let this make you think OH NO! because they are simple changes to URLs and 1 piece of code nothing else.
you are first after the .htaccess file that is in your shops root folder, not the sites root, unless you have the shop in the root that is.
For example:
/public_html/shop/ .htaccess
Place it in a folder just above your shop and site folder on your PC, I did /website/your-domain/adminchanges/subdomain/original/
I also made another folder within that /website/your-domain/adminchanges/subdomain/original/admin this will become clear in a moment
Make another folder mine was website/your-domain/adminchanges/subdomain/changed/
I also made another folder within that website/your-domain/adminchanges/subdomain/changed/admin this will become clear in a moment
That way you can keep things seperate from the main site you have on your pc (or mac)
Open it in an editor such as notepad or notepad+
The line number 15 of text is what you are looking for and it will say RewriteBase /shop/ or something like and you have to change this so it only says
RewriteBase /
Then save this, if you are using a notepad type program you have to make sure you save as and that it is set to ANSI and you change the extension to all files, then save this into the folder you made called /changed/
Then in your site you have 2 config files, both of the same name, which is why I made an extra folder earlier
Copy config.php from your shop root folder, for example public_html/shop/ on your server and you are also after the config file that is in (for example) public_html/shop/admin/
Place that in the admin folder you created earlier, keeping them seperate.
In those files you are looking to see if the URL's in these sections:
This is right at the top of the config.php file from the root folder, the one in the admin folder looks like this:
You want to change these to (but your domain name, not mine lol)
and for the /admin/ version
Make sure when you change these that you save them in the correct changed/ folder, and changed/admin that way you have both the original and altered copy, you just have to make sure you upload the altered ones to their corresponding folder on the server.
If like me you are still having one or 2 issues after you have done this you need to log into the admin panel and change any links you have set up before in layouts or banners so instead of them reading http://www.your-domain.com/shop/images/ for example they will now read http://shop.your-domain.com
Once you have done all this then you should have succesfully moved the links and URLs to read shop.your-domain.com (or your domain in your case)
First there are 3 files you need to get from the server to change a very small amount of code, don't let this make you think OH NO! because they are simple changes to URLs and 1 piece of code nothing else.
you are first after the .htaccess file that is in your shops root folder, not the sites root, unless you have the shop in the root that is.
For example:
/public_html/shop/ .htaccess
Place it in a folder just above your shop and site folder on your PC, I did /website/your-domain/adminchanges/subdomain/original/
I also made another folder within that /website/your-domain/adminchanges/subdomain/original/admin this will become clear in a moment
Make another folder mine was website/your-domain/adminchanges/subdomain/changed/
I also made another folder within that website/your-domain/adminchanges/subdomain/changed/admin this will become clear in a moment
That way you can keep things seperate from the main site you have on your pc (or mac)
Open it in an editor such as notepad or notepad+
The line number 15 of text is what you are looking for and it will say RewriteBase /shop/ or something like and you have to change this so it only says
RewriteBase /
Then save this, if you are using a notepad type program you have to make sure you save as and that it is set to ANSI and you change the extension to all files, then save this into the folder you made called /changed/
Then in your site you have 2 config files, both of the same name, which is why I made an extra folder earlier
Copy config.php from your shop root folder, for example public_html/shop/ on your server and you are also after the config file that is in (for example) public_html/shop/admin/
Place that in the admin folder you created earlier, keeping them seperate.
In those files you are looking to see if the URL's in these sections:
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://www.your-domain.com/');
define('HTTP_IMAGE', 'http://www.your-domain.com/shop/image/');
define('HTTP_ADMIN', 'http://www.your-domain.com/shop/admin/');
// HTTPS
define('HTTPS_SERVER', 'http://www.your-domain.com/');
define('HTTPS_IMAGE', 'http://www.your-domain.com/shop/image/');
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://www.your-domain.com/shop/admin/');
define('HTTP_CATALOG', 'http://www.your-domain.com/');
define('HTTP_IMAGE', 'http://www.your-domain.com/shop/image/');
// HTTPS
define('HTTPS_SERVER', 'http://www.your-domain.com/shop/admin/');
define('HTTPS_IMAGE', 'http://www.your-domain.com/shop/image/');
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://shop.your-domain.com/');
define('HTTP_IMAGE', 'http://shop.your-domain.com/image/');
define('HTTP_ADMIN', 'http://shop.your-domain.com/admin/');
// HTTPS
define('HTTPS_SERVER', 'http://shop.your-domain.com/');
define('HTTPS_IMAGE', 'http://shop.your-domain.com/image/');
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://shop.your-domain.com/admin/');
define('HTTP_CATALOG', 'http://shop.your-domain.com/');
define('HTTP_IMAGE', 'http://shop.your-domain.com/image/');
// HTTPS
define('HTTPS_SERVER', 'http://shop.your-domain.com/admin/');
define('HTTPS_IMAGE', 'http://shop.your-domain.com/image/');
If like me you are still having one or 2 issues after you have done this you need to log into the admin panel and change any links you have set up before in layouts or banners so instead of them reading http://www.your-domain.com/shop/images/ for example they will now read http://shop.your-domain.com
Once you have done all this then you should have succesfully moved the links and URLs to read shop.your-domain.com (or your domain in your case)