0

I know there are bunch of articles for this, but it actually does not work for this client. Specifically now I need 2 websites to run

Here is my setup:

  1. .htaccess

    ...
    
    SetEnv MAGE_RUN_TYPE website
    SetEnv MAGE_RUN_CODE base
    
    SetEnvIf Host .*wholesale.* MAGE_RUN_CODE=wholesale
    SetEnvIf Request_URI "(wholesale)" MAGE_RUN_CODE=wholesale
    
    ...
    
    <IfModule mod_rewrite.c>
    
    ...
    
    RewriteCond %{HTTP_HOST} .*wholesale\.* [NC]
    RewriteRule .* - [E=MAGE_RUN_CODE:wholesale]
    RewriteCond %{REQUEST_URI} ^/wholesale
    RewriteRule .* - [E=MAGE_RUN_CODE:wholesale]
    
    RewriteCond %{ENV:REDIRECT_MAGE_RUN_CODE} (.+)
    RewriteRule .* - [E=MAGE_RUN_CODE:%1]
    
    ...
    
  2. No modifications to index.php (update: I won't do any changes to index.php file as it's not needed, the file itself may be overwritten by one of updates from Magento Core team and actually it won't help)

  3. Directory structure on doc root:

    root@xxx [/home/devserver/public_html]# ls -la
    drwxr-x---  9 devserver nobody      4096 Dec  8 09:25 ./
    drwxr-xr-x 14 devserver devserver   4096 Nov 26 23:07 ../
    ...
    drwxr-xr-x 14 devserver devserver   4096 Nov 22 03:25 store/
    lrwxrwxrwx  1 devserver devserver     25 Nov 26 23:10 wholesale -> /home/devserver/www/store/
    ...
    
  4. Backend settings are: Magento Admin Panel Settings

Whenever I open the homepage the content is shown, but the secure pages like: https://DOMAIN_NAME/wholesale/customer/account/login/ leads to 404

After investigation I found that MAGE_RUN_CODE and MAGE_RUN_TYPE are good, but there is a problem in getting the controller app/code/core/Mage/Core/Controller/Varien/Router/Standard.php:121), basically the method setBaseUrl is getting $_SERVER['SCRIPT_NAME'] and generates Base Url out of it, which is "/store/" for both symbolyc link and base directory our of doc root.

Is there something wrong with my setup or should I go this way https://stackoverflow.com/questions/9199854/how-do-i-override-mage-core-controller-request-http?

UPDATE:

  • A separate directory which stores the same data helps. Is there a way to say apache to overwrite SCRIPT_NAME for specific website/store/storeview ?
  • To go with a multistore installation, I would go with the root magento folder on / , then create two subfolders with a different index.php for each of them. You change the path to Mage.php, and it would go fine. – hellimac Dec 9 '16 at 8:25
  • As I told, I don't want to change index.php file as it is a core file and may be changed later with Magento updates – PassTeT Dec 9 '16 at 21:34
  • Adding two new folders with new index.php will not make you change the original index.php if you don't want to. And after an upgrade/patch, you check what changes were made and if it changed the original index.php. If that's the case, you'll just have to add those modifications in the new ones too. That's the normal work to do after an upgrade/patch anyway! – hellimac Dec 13 '16 at 2:31
  • No, that's not OK to check what files were changed each time you upgrade/patch Magento. And besides I have no problems with my setup on other environments, so basically the issue seems to be with the .htaccess rather then with a Magento setup. Thanks in any way – PassTeT Dec 13 '16 at 7:12
  • If you're patching a Magento website that you developped (added specific development, extensions, etc...) without knowing what you are patching, the patch will be useless. Just as an example, SUPEE-6788. You needed to change a lot of extensions config, authorize blocks, and a lot of work specific to your changes. – hellimac Dec 13 '16 at 8:42
0

I would suggest you follow this tutorial. It explains how to set up Magento as required. I have used it many times before

  • This won't work, the document root is not Magento, and I don't want to overwrite core files, like index.php, I am searching for a good solution – PassTeT Dec 9 '16 at 21:34
  • Editing / creating index.php is allowed if for multiple stores – Goose84 Dec 9 '16 at 21:36
  • According to official documentation it's not alowed - devdocs.magento.com/guides/v2.0/config-guide/multi-site/… . If you check my description again you will see that I have correct MAGE_RUN_CODE without modifying the index.php file, which may be overwriten by Magento update in future, I need symbolyclinks instead fo creating directory which emulates Magento – PassTeT Dec 9 '16 at 21:39
  • The docs are for m2 and not m1 which you have tagged. Which version are you using? – Goose84 Dec 9 '16 at 21:42
  • m1, in any case, the process remains the same for both versions. here is another example of using same logic as I did eschrade.com/page/… . The only difference is that $_SERVER['SCRIPT_NAME'] would return correct value for their case, but not mine. – PassTeT Dec 11 '16 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.