Microsite or Custom Landing Page for a Separate Domain
-
16-10-2019 - |
Question
I'm looking to create either a "microsite" or a custom landing page for a separate domain. Ideally, myproduct.com would land on a hidden page in my Magento site with its own look and feel. I do not want this page to appear in search results.
I am using Magento Enterprise 1.12 running on RHEL, Nginx, and Apache.
Solution
You can use store view feature of Magento. Create custome store view and use this for custom sub-domain. See steps:
1. Create store view:
2. Create cms page and edit content as whatever you want, you can change design and layout updates also.
3. Change store view configuration
4. Create new folder in your Magento store root folder. Copy .htaccess and index.php files to this folder and change Magento run settingis:
index.php (change relative path of MAGENTO_ROOT according to sub domain folder):
define('MAGENTO_ROOT', getcwd().'/..');
.htaccess (add custom store view code to system variable)
SetEnv MAGE_RUN_CODE "sub_domain"
sub_domain
is store view code which is created on step 1.
You can use this logic with any subdomain or separated domain. As a result if you enter this subdomain, your custom cms landing page will be shown with your default store theme and this page will be hidden for main store.
OTHER TIPS
You can specify custom theme and page layout for CMS, product, and category pages; just visit the appropriate page and select the tab related to "custom design" settings.
Regarding search engine indexing, that can't be controlled via a simple setting, but you can come close in the "custom layout XML" section using the following:
<block name="nofollow.head" type="core/text" parent="head">
<action method="setText">
<text><![CDATA[<meta name="robots" content="noindex" />]]></text>
</action>
</block>
This will add the appropriate meta tag to the page's output which should be honored by the search engines.