Magento Multiwebsite Configuration Setup - magento

I am using multi website magento store having 3 websites for books,electronics and apparels in subdirectories like www.example.com/books, www.example.com/apparels. Is it necessary to include all folders like app, downloader, skin, etc in root folder to subdirectories or any other option is there because it seems to consume more memory for each one.

I manage one Magento site with two stores (two totally different URLs) operating from one instance of Magento. Each URL points to a different base directory on the hosting site. One directory holds the entire Magento installation. The second directory uses a combination of symbolic links and actual files as follows.
Symbolic links: app, errors, includes, js, media, skin, var
Actual files: .htaccess, index.php
www-root/directory1/[all magento files]
www-root/directory2/[symbolic links and .htaccess and index.php files]
You then set the insecure and secure base URLs for each store. In this case there is a separate root category for each store. And many of the Magento configuration parameters may be set individually for each store or use the default value.

No, you don't have to.
You can create multiple stores from system -> Manage Stores -> Create Store, if you don't have them already.
You can manage the url of the stores from system -> configuration -> Web and set secure and unsecure base url for each store by selecting the configuration scope on the top left.
E.g.: You can select the scope to 'books' store and set base url to www.example.com/books and set the scope to 'apparels' store and set base url to www.example.com/apparels.
Edit:
You also have to copy the index.php to the subfolder and edit this file. E.g. for www.example.com/apparels, add:
$mageRunCode = 'apparels';
$mageRunType = 'website';
before the line:
Mage::run($mageRunCode, $mageRunType);
Also try to copy the .htaccess to the subdirectory.

No, you no need to copy all folder , you need to create folder for books & apparels then copy your index.php and .htaccess file from magento root folder to existing folder (both books & apparels) also you need to set base url in magento adminpanel > system > configuration > web for new stores

Related

How to run Multiple codeigniter application in single shared hosting server?

I am using shared hosing for Codeigniter application for deployment.
How can i run staging url on live server?
1) domain.com (Working)
2) domain.com/staging/ (Not working, showing 404 error)
I created staging folder under public_html directory, now put All CI code in staging folder, and tried to run the application with URL domain.com/staging/ but it redirect on domain.com/404
I expect to run domain.com for users and domain.com/staging for development. (Staging URL i will use for development and after that i will place the same code for live URL.)
This is most easily done by using a subdomain for the staging version, i.e. staging.doman.com. The folder where you put the CI files isn't super important as the subdomain will be set to use the directory you choose.
You will either need to have complete control over the server or have a service provider that allows you to set up subdomains.
- Expanded Answer -
If you cannot set up a subdomain then your next best option is to use the advice in the documentation on Managing you Applications. It isn't required to use the file structure shown there. In your case try the following.
Create a folder on the same level as application named staging.
Into that folder copy all the folders and files normally found in /application.
Add all application folders and files required by your site. The files in these folders are those that make up the application you are staging.
Make a copy of index.php (the file at the root of the public folder, i.e. domain.com/index.php) and name it staging.php. Both index.php and staging.php will be in the same folder.
Edit staging.php and change the value of $application_folder to be the absolute path to the staging folder. For example:
$application_folder = '/path/to/domain.com/public_folder/staging';
The path above is an example. You must replace it with the actual path in your server. If you have no idea what the full and absolute path is you can use
$application_folder = dirname(__FILE__).'/staging';
Browse to the URL domain.com/staging.php and you should get your default controller's output. To test that you are actually seeing the staging version of the page temporarily change something in the view file so there can be no doubt.
You will go to other controllers by using the URL domain.com/staging.php/other_controller.
Change the value of $config['index_page'] in /staging/config/config.php to staging.php, e.g.
$config['index_page'] = 'staging.php';
Without the above change redirect() and many other "helper" functions will not work correctly.
(Optional?) You can probably edit the main .htaccess and add rewrite rules for staging.php the same way it is done for index.php. But I will leave that as an exercise for you. (Or for another SO question.)
A final word. It might be necessary to make other configuration changes to accommodate the revised file structure. I tested the answer here but did not go beyond the most basic task of browsing to controllers. Most likely config values for sessions, cookies, and many others will need to be adjusted for the staged version to work correctly. Check out the documentation on Handling Multiple Environments for guidance on making this less painful.

How to add subdomain to Magento?

I need to create geo subdomain for one city (for example shop.com & london.shop.com). I want the same store. But also I want to have different pages like:
london.shop.com/contacts & shop.com/contacts.
I use magento 1.9.2.1
you need to create multiple websites and store for different domain.create one folder on root and put index.php and .htaccess file and change in index.php store name or website name at last.
Please refer below link
http://inchoo.net/magento/how-to-set-multiple-websites-with-multiple-store-views-in-magento/

Creating an admin section controllers and views in Code Igniter 2.0

I have created my site with controllers such as about, products etc... which gives me example.com/about/ etc..
How would I create a admin section with the same controller name, like example.com/admin/about or example.com/admin/products ?
How do I organize my controllers?
2 more options to compliment WebweaverD answer.
Use Modular Separation
Create a second application folder and index file, that will be responsible for admin, connect them to the same system folder.
The second option is really easy to manage once you have set it up. There are variations but I find the structure below to be the most convenient.
mykewlwebsite.com
apps/
frontend/
app/ frontend codeigniter application folder
public/
index.php
assets/ frontend js, css, images
backend
app/ backend codeigniter application folder
public/
index.php
assets/ backend js, css, images
config/
database.php
constants.php
system/ codeigniter system folder
The database.php file contains the code from CodeIgniter's config/database.php and is shared for all applications of your project - simply remove all code and add require_once('../../../../config/database.php'); to the config/database.php
index.php files inside public folders have two important variables $system_path and $application_folder, change them to
$system_path = '../../../system/codeigniter';
$application_folder = '../app';
constants.php file can have some constants like the ENVIRONMENT constant from the index.php files and some other. Just require_once() it from the index.php files.
Though there are pros and cons.
PROS
For those of you, who are developing on localhost and deploying to servers via FTP or other systems can simply upload one folder - apps and overwrite the target folder without fear of overwriting database.php settings (I'm sure most of you have them different from the local ones).
Adding one more application is easy - just duplicate one of existing. You can add as many applications as you want - api, ajax, user cabinet, etc.
CONS
This structure is meant to be used if you have a domain as mykewlwebsite.com and have the ability to add sub-domains to it, so you just configure the home folders for each of them:
mykewlwebsite.com: path/to/mykewlwebsite.com/apps/frontend/public/
admin.mykewlwebsite.com: path/to/mykewlwebsite.com/apps/backend/public/
api.mykewlwebsite.com: path/to/mykewlwebsite.com/apps/api/public/
You have a few options here:
1) CREATE A SUBFOLDER - Put them in a folder called admin within the controllers directory (in application/contollers/admin/products.php)
A word of warning here is that you can only go one folder deep or codeigniter gets upset. Also, it will use first level controller/methods first so be careful of naming conflicts - e.g if you have an admin controller with a products method in it, that will get called before it looks in the admin directory for a products controller. (when going to example.com/admin/products)
2) USE THE ROUTES FILE - If it is just the urls you are worried about you could just call the controllers whatever you want and use the application/config/routes to redirect those paths to the controllers you want like this:
controller name: admin_products.php
routes file:
$route['admin/products'] = "admin_products";
3) USE A MASTER CONTROLLER FOR ALL - Final option would be to have a single admin controller and use named methods inside it, so for example you have admin.php controller with a products method within it this would then be called by admin/products uri (this will probably get messy though in a big application/site - not recommended)
Hope I have explained this OK for you, if you need any clarification please ask and I will try to elaborate.

Magento 1.6.2 Multiple Stores

I am trying to integrate multiple magento sites within the one installation. From what I have found i need to use a parked domain method however I have tried various methods to get it all working however I keep getting the 2nd store redirecting to the main store so I am looking for the best method to allow me to run multiple websites.
Any help is greatly appreciated
We currently have 4 stores all sharing one Magento installation & set of products. Each has it's own unique URL.
Create your Stores
Go to System -> Manage Stores
Click on Create Website. In the Name field, enter your store name. In the Code field, enter a unique code [lowercase & without spaces - we're going to give it a code of domain1 for our example] (to be used later) & Save.
Click on Create Store. In the Website field, select the website from step 2. In the Name field, enter a name. In the Root Category field, select the Root Category for your store & Save.
Click on Create Store View. Select the store you just created (from the dropdown menu) for Store. Type a name for your store in the Name field (Example from Magento is English Store). In the Code field, enter a unique string to identify the store view (just like for your store). Change the Status to Enabled & Save.
Repeat for all your stores
Configure your stores in the Magento Admin Configuration Section
Go to System -> Configuration
In the Store Scope (top-left dropdown), choose your first Store.
Choose Web from the Left-side menu
Open the Unsecure & Secure sections
Change the domains to what they would be (i.e. - http://www.domain1.com/) Don't forget the trailing slash at the end
Repeat for all stores
Server Config (for Magento versions 1.4.0.1 and greater)
Point your domain (e.g. - www.domain1.com) to your server where your single Magento instance is installed
Set up a Pointer/Parked domain on your server (see your Host's instructions or contact them)
In the .htaccess file on the root of your install, put in the following code for each of your stores
SetEnvIf Host .*domain1.com
MAGE_RUN_CODE=domain1 <- This was your important code from step 2 under Create your Stores SetEnvIf Host
.*domain1.com MAGE_RUN_TYPE=website
This set of 2 must be repeated for every domain you have.
For our particular stores/domains (might find useful)
Some servers, particularly those running Litespeed Web Server, the SetEnvIf directive does not get recognized in the .htaccess file. This was particularly true for us.
We had to do the following
Find RewriteBase / or RewriteBase /magento/ or etc
RewriteCond %{HTTP_HOST} .domain1.com [NC]
RewriteRule . - [E=MAGE_RUN_CODE:domain1]
RewriteCond %{HTTP_HOST} .domain1.com [NC]
RewriteRule . - [E=MAGE_RUN_TYPE:website]
We also have symlinks set up on our server (under each or our domains) to point to our main domain's folders (for the app, includes, js, lib, media, shell, skin, var)
Multi Store in Magento v1.6.2
in the VirtualHost configuration set the DocumentRoot to where you have your Magento installed (something like /var/www/magento), so it will be the same for every domain as we want only one Magento install for each domain
in Magento's admin, go to System -> Manage Stores and create your websites with their stores and store views (before that you'll have created one root category for each website). Reindex after everything is created
go to System -> Configuration and change the scope (the dropdown on the upper left) to one of the website. Go to the (General) Web -> Unsecure tab, uncheck the "Use Default" and indicate the domain in the Base URL field. Do the same for the secure
open the .htaccess at the root of your Magento install and at the end of it add the rules to determine which website to show according to the domain. For example, if you have set the codes website1 for domain1.com and website2 for domain2.com, put this:
SetEnvIf Host ^domain1.com$ MAGE_RUN_CODE=website1
SetEnvIf Host ^domain2.com$ MAGE_RUN_CODE=website2
SetEnv MAGE_RUN_TYPE website
and you're all set :)
HTH
Did you change your base urls for the second store configuration?
Navigate to:
System>Configuration>Web>Unsecure
System>Configuration>Web>Secure
Then change the Current Configuration Scope (top of left sidebar): your second store config
Deselect use default and enter your second store's path:
Base URL : http://yourdomain.com/
Secure Base URL: https://yourdomain.com/

CodeIgniter How to create Multiple Site with One CMS

I want to create a blog site with only one CMS. This CMS will be in different domain.
For example: mycms.com
Then my blog sites are also in different domains.
For example: website1.com, website2.com, website3.com
They will all use mycms.com as their admin
*Images will be uploaded in mycms.com/images/ so all the 3 websites will get the images from this directory
If images are loaded on website1.com from the main database, they should be displayed as if they're from website1.com. So for example website1.com/images/cat.jpg instead of mycms.com/images/cat.jpg
How will I build this using codeigniter?
You can use the same CodeIgniter /System and /Application folders for all the websites if you like; just make sure all the index.php files are setup to use those same folders for $system_path and $application_folder respectively. Note that these sites also need to reside on the same server.
You can serve up different content by checking $_SERVER['HTTP_HOST'] for the domain the request came from.
As for htaccess you should be able to use %{HTTP_HOST}/$1 or %{HTTP_HOST}$1 (depending on server config) to make the rewrite rule dynamic.
I am actually building a similar project right now using CodeIgniter but there are also several other projects available like halogy, codefight, pyro (with an extension), and many others.
CodeIgniter has a System and an Application folder. You could have one global system folder and then one application folder for each of your subdomains, or you could have one application folder and just make your subdomian folders parallel with your www folder.

Resources