ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

MSM Subfolder Setup Madness

May 05, 2011 1:39pm

Subscribe [3]
  • #1 / May 05, 2011 1:39pm

    Adam Faux

    14 posts

    Hi Guys,

    I think i’m literally losing my mind trying to figure this one out. I seem to be finding setting up MSM where the additional sites are in subfolders within the EE installation, and having the site served up to a separate domain name on the same server so incredibly difficult, where others seem to have achieved it with ease 😖

    Could some one please help me get this set up? I would be incredibly grateful.

    The situation is this:

    - EE & MSM installed correctly on a Linux Server running Plesk 9.2.2
    - EE & MSM set up on http://www.domain1.co.uk/
    - The additional domain is set up as a domain alias http://www.domain2.co.uk/ pointing to http://www.domain1.co.uk/
    - Folder structure:

    > Images
    > System Folder
    > Themes
    > Domain2
       > Index.php

    The solution that I think I need is something like:

    Use .htaccess or Mod Re-writes to direct requests for http://www.domain2.co.uk/ to the Domain2 subfolder

    Is this correct? What would I need to set in the .htaccess?

    I realise this is a big question and is regarding the server more than EE itself but I’m looking for advice as to whether this is the best way to go about it, plus I’ve read countless sites about adjusting the .htaccess file but I’m really not sure what I need to do.

    Any help or advice would be greatly appreciated.

    Thanks

    Adam

  • #2 / May 06, 2011 6:45am

    John Henry Donovan

    12339 posts

    Adam,

    Try this in your htaccess

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTP_HOST} ^domain2.co.uk [NC]
    RewriteCond %{REQUEST_FILENAME} !Domain2/
    RewriteRule ^(.*)$ Domain2/$1 [L]
  • #3 / May 06, 2011 8:25am

    Adam Faux

    14 posts

    John,


    Thanks for your reply. I will give that a try and see how it goes, could you possibly elaborate on that and briefly explain what each line of the code ‘does’ so me, other and future readers might get a better idea of what it does for future reference and to build upon please?

    Thanks

    Adam

  • #4 / May 06, 2011 9:02am

    Adam Faux

    14 posts

    John,

    I tried the code you provided for the .htaccess and haven’t had any joy as of yet.

    I obviously replaced domain2’s with the correct URLs and played around with changing ‘c2ctourism’ with the folder name which I want the domain to point to.

    Am I right in thinking that the .htaccess file needs to be here:

    > Images
    > System Folder
    > Themes
    > .htaccess
    > Domain2
       > Index.php

    I’m happy to give you or one of the other moderators temporary access if you think it would help to get in a see whats happening?

  • #5 / May 06, 2011 1:02pm

    Adam Faux

    14 posts

    FIIIIIAAAANNNALLLLYYYY SORTED IT! 😊

    John, you were almost there with the code, turns out there was simply one line missing “Options +FollowSymlinks”:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
     
    RewriteCond %{HTTP_HOST} domain2.co.uk
    RewriteCond %{REQUEST_URI} !subfolder_name/
    RewriteRule ^(.*)$ subfolder_name/$1 [L]

    After setting domain2.co.uk as a domain alias to domain1.co.uk in Plesk, I then:

    1. Set up the new site in EE following the EE Docs,

    2. Created a .htaccess file containing the code above (with my own domain and subfolder names)

    3. Uploaded the .htaccess file to domain1.co.uk’s root folder alongside folders such as system - themes - images

    4. Checked it was working by visiting domain2.co.uk and making sure it was serving up the index page within the domain2.co.uk subfolder but keeping domain2.co.uk URL

    5. Then changed the URL to the root directory of your site within General Configuration in EE to domain2.co.uk and that sorted the {site_url} issues.

    6. Repeated the process using an additional domain and simply inserting the following code in the .htaccess file:

    RewriteEngine On
    Options +FollowSymlinks
    RewriteBase /
     
    RewriteCond %{HTTP_HOST} domain2.co.uk
    RewriteCond %{REQUEST_URI} !domain2_subfolder/
    RewriteRule ^(.*)$ domain2_subfolder/$1 [L]
    
    RewriteCond %{HTTP_HOST} domain3.co.uk
    RewriteCond %{REQUEST_URI} !domain3_subfolder/
    RewriteRule ^(.*)$ domain3_subfolder/$1 [L]

    and replacing the details with domain3.co.uk info.

    Soooooo, it all seems sorted. I now need to work out how to provide email accounts for the additional domains in plesk as the domains are ‘alias’s’ rather than domains with hosting.

    But at least one fire is out…. for now! 😊

    Adam

  • #6 / May 08, 2011 2:01pm

    Greg Salt

    3988 posts

    Hi Adam,

    Glad that you got this resolved. Please post again if you have further questions or problems.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases