0

About the "off topic" flag : This is not offtopic. As you can see in the accepted answer, it was about Magento config (db + htaccess)

For corporate / political reasons, we are trying to add a fake subfolder to our base urls. I can't configure vhosts/base urls to make it work with this additional string (404 for any page but home page)

Before :
subdomain1.company.com -> store 1
subdomain2.company.com -> store 2

After (help ?) :
subdomain1.company.com/corporate/ -> store 1
subdomain2.company.com/corporate/ -> store 2

I've set each vhost like this :

<VirtualHost *:80>
    DocumentRoot "/path/to/root/directory"
    ServerName subdomain1.company.com
    Alias /corporate "/path/to/root/directory"
    <Directory /path/to/root/directory>
        Order allow,deny
        Allow from all
        AllowOverride All
        RewriteEngine On
        Options +FollowSymlinks
    </Directory>

    SetEnv MAGE_RUN_CODE store1
    SetEnv MAGE_RUN_TYPE store
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "/path/to/root/directory"
    ServerName subdomain2.company.com
    Alias /corporate "/path/to/root/directory"
    <Directory /path/to/root/directory>
        Order allow,deny
        Allow from all
        AllowOverride All
        RewriteEngine On
        Options +FollowSymlinks
    </Directory>

    SetEnv MAGE_RUN_CODE store2
    SetEnv MAGE_RUN_TYPE store
</VirtualHost>

And my new base urls are subdomain1.company.com/corporate/ and subdomain2.company.com/corporate/
Obviously, I did something wrong. Any help would be highly appreciated....

5
  • Did you change the URL in the Magento settings (in the admin panel -> System -> Configuration -> GENERAL -> Web) and add RewriteBase /corporate/ to .htaccess in Magento main directory?
    – michael
    Commented Sep 22, 2015 at 10:52
  • base urls are set (domain1.company.com/corporate/ and domain2.company.com/corporate/). I didn't set any RewriteBase in .htaccess. I'll try that Commented Sep 22, 2015 at 10:54
  • RewriteBase did the trick. @michael feel free to write a real answer and I'll accept it :) Commented Sep 22, 2015 at 10:58
  • possible duplicate of Moving Magento installation from localhost to sub-directory in server root?
    – 7ochem
    Commented Sep 22, 2015 at 11:43
  • No it's not. We just needed to display /corporate/ in the url, but there is no "corporate" subdirectory in file system Commented Sep 22, 2015 at 12:47

1 Answer 1

0

You have to check/do 2 things:

  1. To change the URL in the Magento settings (in the admin panel -> System -> Configuration -> GENERAL -> Web).
  2. To add RewriteBase /corporate/ to the .htaccess in the Magento main directory (after RewriteEngine on).

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