Search

So we're putting a site together in work and it involves 1 client that has 2 sites... i.e different domains.

for ease of use for them I suggested 1 install that would serve 2 domains with different content.

So far so good. Different sections are setup and the logic is (in theory) all set to go.

Has anyone put a setup where you use 2 top level pages as the root pages of either domain? and remove that root page from Nav and nay URL's that get served by either site? (URL_Router useful here?)

Would @michael-e 's ninja domain technique be the answer here?

What I'm after is a way to remove the root page from being present in the URL for either domain.. I think I've just answered my own question but would appreciate a confirmation if URL_Router is indeed the best approach for this?

My setup for pages for 2 domains is as follows:

domain1_root.xsl
   home.xsl
   about.xsl
   portfolio.xsl
   case_studies.xsl
domain2_root.xsl
   home.xsl
   about.xsl
   portfolio.xsl
   news.xsl
   case_studies.xsl

Domain1.com would need to land at the home.xsl sub page and Domain2.com would need to land on it's first subpage home.xsl file.

Make sense?

It's been a while since I tried it, but I believe the URL writing that's part of Michael's ninja domain method means that no additional URL router stuff is required, and that your domain1/2_root.xsl pages appear as if they are each site's home page.

I think URL router or a hard-coded redirect in the .htaccess would do this.

  • probably you might want to block all links from domain1.com/subpageDomain2 just in case at least

Ok cool, thanks gents!

Ninja Domain technique it is :)

moonoo2 may I ask what your htaccess file looks like or how you got the above "structure" working?

I believe michael-e 's ninja domain technique uses the following setup:

domain1_root.xsl
   home.xsl
   about.xsl
   portfolio.xsl
   case_studies.xsl
   domain2_root.xsl
      home.xsl
      about.xsl
      portfolio.xsl
      news.xsl
      case_studies.xsl

And I'd love to have to top level root pages instead like you've described above. Just can't get my head arround it: httaccess, index page etc.

Thanks!

I'll try and dig out the htaccess stuff this weekend.

It's heavily based on Michael-e's technique.

hi padex,

The setup is correct - the index page would always be domain1_root.

You would then use the .htaccess to add the sym_page variable if I am not mistaken for the other domain in order to fetch the correct page.

Hi,

I am still a little confused, sorry.

Does the domainXYroot.xsl and its home.xsl need to share the same content? As I want the home.xsl pages to be the start page and the domainXYroot.xsl just to be a "container".

So I would get:

domain1.com
domain1.com/page2
domain1.com/page3

domain2.com
domain2.com/page2

As stated in the Ninja Domains tutorial, you should create a page which serves as the root page for your second ("satellite") domain. This page will be here:

http://domain1.com/domain2/

If you apply the rewrites, the page is also here:

http://www.domain2.com

(And http://domain1.com/domain2/ is even redirected.)

Thanks michael-e! I got that. But I was curious how moonoo2 got his structure working.

My bad. been busy. I'll dig it out today.

It's just replicating michael-e's secondary domain concept for each domain you want under the one install.

Pitfalls to watch out for are 404 pagrs etc... but thats covered by conditionals on root param to render a different visual for each domain.

OK @padexx, here's what I've used when pointing 2 domains at 1 symphony install.

My .htaccess isn't my strongest but it works for my purposes at present.

The bits to look out for are the ###DOMAIN REWRITES and ###DOMAIN PAGE REWRITES below and the positioning of them in the ordering of rules.

<IfModule mod_rewrite.c>

RewriteEngine on
RewriteBase /subfolder/

### DOMAIN1 REWRITES
RewriteCond %{HTTP_HOST} www.domain1.com:8080$ [NC]
RewriteRule ^domain1/?(.*/?)$ http://domain1.com:8080/domain1/$1 [R,L]
RewriteRule ^domain1$ http://www.domain1:8080/domain1/ [R,L]

### DOMAIN2 REWRITES
RewriteCond %{HTTP_HOST} www.domain2.com:8080$ [NC]
RewriteRule ^domain2/?(.*/?)$ http://www.domain2.com:8080/domain2/$1 [R,L]
RewriteRule ^domain2$ http://www.domain2.com:8080/domain2/ [R,L]

### SECURITY - Protect crucial files
RewriteRule ^manifest/(.*)$ - [F]
RewriteRule ^workspace/utilities/(.*).xsl$ - [F]
RewriteRule ^workspace/pages/(.*).xsl$ - [F]
RewriteRule ^(.*).sql$ - [F]
RewriteRule (^|/). - [F]

### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
RewriteRule .* - [S=14]

### IMAGE RULES
RewriteRule ^image/(.+.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC]

### CHECK FOR TRAILING SLASH - Will ignore files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ $1/ [L,R=301]

### URL Correction
RewriteRule ^(symphony/)?index.php(/.*/?) $1$2 [NC]

### ADMIN REWRITE
RewriteRule ^symphony/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^symphony(/(.*/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING}       [NC,L]


### DOMAIN1 PAGE REWRITES
RewriteCond %{HTTP_HOST} www.domain1.com:8080$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/?)$ index.php?symphony-page=domain1/$1&%{QUERY_STRING} [L]

RewriteCond %{HTTP_HOST} www.domain1.com:8080$ [NC]
RewriteRule ^$ index.php?symphony-page=domain1 [L]


### DOMAIN2 PAGE REWRITES
RewriteCond %{HTTP_HOST} www.domain2.com:8080$ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/?)$ index.php?symphony-page=domain2/$1&%{QUERY_STRING} [L]

RewriteCond %{HTTP_HOST} www.domain2.com:8080$ [NC]
RewriteRule ^$ index.php?symphony-page=domain2 [L]


### FRONTEND REWRITE - Will ignore files and folders
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*/?)$ index.php?symphony-page=$1&%{QUERY_STRING}        [L]

Just a sidenote: You don't need to place these extra rules inside the Symphony part of your .htaccess file. Indeed you should put them before the Symphony part. You never know what a Symphony update will do to the rules! Symphony won't try and parse your additions (simply because the Symphony part of the .htaccess is meant to remain untouched, so it can be changed by an updater script if necessary).

So I encourage the following schema:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    (Your rules here)

</IfModule>


### Symphony 2.3.x ###
Options +FollowSymlinks -Indexes

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteBase /

    (Symphony's rules here)

</IfModule>
######

Ahh thanks Michael-e, I didn't think of that.

Changing mine locally for future project :)

How do you deal with 404 and 403 files on a multi domain setup?

In my use case it was rather simple, cause the template "domain logic" was in master.xsl. So I simply defined a 404 page which used master.xsl, so it automagically had the right "domain template" applied to it. (A 404 page defined in Symphony will be thrown on any 404 error, no matter which domain is used for the request).

Thanks moonoo2 and michael-e! I'll try it next weekend...

What's really great now is that Author Roles extension gives me control over what login sees what sections!

So it looks like 2 completely different installs by setting up a role for each domain user login and only permitting them to see their own sections! thanks to all for the concepts and insights :)

Hi,

micheale's suggestion does not work for me!? If I put the following part above the symphony rules it does not work.

RewriteCond %{HTTP_HOST} www.domain2.com:8080$ [NC]
RewriteRule ^$ index.php?symphony-page=domain2 [L]

I am able to get to the login page but after trying to login I get the following error:

The page you requested, /domain2/symphony/login/, does not exist.

If I put my rewrite code below the symphony stuff it works.

It would probably work if you took the suggested code from the Ninja Domains tutorial. My first guess is that you missed:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f

If you change the tutorial code, you have to think twice. Rewrite rules can be tricky at times.

I am sorry, but I am lost! I've gone back and forth and I am only able to get the frontend or the backend to work properbly.

I've set up domain1.com and domain2.com as virtual host and switched to the ninja tutorial setup. Here is my htaccess file:

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /

    ### GLOBAL REWRITE

    RewriteCond %{HTTP_HOST} ^www.domain1.com$ [NC]
    RewriteRule ^(.*)$ http://domain1.com/$1 [R,L]

    RewriteCond %{HTTP_HOST} ^www.domain2.com$ [NC]
    RewriteRule ^(.*)$ http://domain2.com/$1 [R,L]

    ### PAGE REWRITE

    RewriteCond %{HTTP_HOST} domain1.com$ [NC]
    RewriteRule ^domain2/?(.*/?)$ http://domain2.com/$1 [R,L]
    RewriteRule ^domain2$ http://domain2.com/ [R,L]

    RewriteCond %{HTTP_HOST} domain2.com$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*/?)$ index.php?symphony-page=domain2/$1&%{QUERY_STRING} [L]

    RewriteCond %{HTTP_HOST} domain2.com$ [NC]
    RewriteRule ^$ index.php?symphony-page=domain2 [L]

</IfModule>


### Symphony 2.3.x ###
Options +FollowSymlinks -Indexes

<IfModule mod_rewrite.c>

    RewriteEngine on
    RewriteBase /

    ### SECURITY - Protect crucial files
    RewriteRule ^manifest/(.*)$ - [F]
    RewriteRule ^workspace/utilities/(.*).xsl$ - [F]
    RewriteRule ^workspace/pages/(.*).xsl$ - [F]
    RewriteRule ^(.*).sql$ - [F]
    RewriteRule (^|/). - [F]

    ### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
    RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
    RewriteRule .* - [S=14]



    ### IMAGE RULES
    RewriteRule ^image/(.+.(jpg|gif|jpeg|png|bmp))$ extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC]





    ### CHECK FOR TRAILING SLASH - Will ignore files
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !/$
    RewriteCond %{REQUEST_URI} !(.*)/$
    RewriteRule ^(.*)$ $1/ [L,R=301]

    ### URL Correction
    RewriteRule ^(symphony/)?index.php(/.*/?) $1$2 [NC]

    ### ADMIN REWRITE
    RewriteRule ^symphony/?$ index.php?mode=administration&%{QUERY_STRING} [NC,L]

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^symphony(/(.*/?))?$ index.php?symphony-page=$1&mode=administration&%{QUERY_STRING}   [NC,L]

    ### FRONTEND REWRITE - Will ignore files and folders
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*/?)$ index.php?symphony-page=$1&%{QUERY_STRING}    [L]

</IfModule>
######

As long as the PAGE REWRITE stuff is in it I am not able to browse the backend. Looks like something is breaking the admin rewrithe and adding domain2 to the URL request.

The page you requested, /domain2/symphony/publish/adresse/, does not exist.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details