3

I run multiple sites off one EE installation using the old method, and one issue with that is the Pages module. For example, I need an About Page for each site, directly following the domain. That means that when I setup these Pages, the Page URI would be /About/ in both cases.

This does not work (which the documentation does make clear), even if the Page content is stored in two separate channels and even if each uses a separate Template.

My question, then, is if there's any work-around for this issue? For example, each of my sites does have a site variable defined in index.php. Would it be plausible to use that in any way to allow multiple Pages to share the same URI.

1

I do this with one website with the following setup: Both domains point to the same directory
(second.com is a ServerAlias for main.com)

in the main domain .htaccess redirects requests for second.com to a subdirectory "other"

### second.com to directory
RewriteCond %{HTTP_HOST} second.com$ [NC]
RewriteCond %{REQUEST_URI} !^/(other)
RewriteCond %{REQUEST_URI} !\.(jpe?g|js|gif|png|xml|swf|bmp|css|pdf)$
RewriteRule ^(.*)$ other/$1 [L]

### all requests to EE index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(jpe?g|js|gif|png|bmp|swf|xml|css|html?|pdf)$
RewriteRule ^(.*)$ index.php?/$1 [L]

in the "other" directory the htaccess redirects to a 'hard' template group

### Allow some of the 'real' template groups
RewriteCond $1 ^(specialgroup|sometemplategroup)
RewriteRule ^(.*)$ index.php?/$1 [L]

### All others go to hardcoded template group other/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.(jpe?g|js|gif|png|bmp|xml|css|html?|swf|pdf)$
RewriteRule ^(.*)$ index.php?/other/$1 [L]

In the index.php for the subdirectory, setup some config variables

$assign_to_config['template_group'] = 'other';
$assign_to_config['template']       = 'welcome';
$assign_to_config['site_404']       = 'other/404';

$assign_to_config['site_name']  = 'My Other Site';
$assign_to_config['site_url']   = 'http://second.com/';

To be able to actually use the "site_name" and for it to work, you need to hack the core https://support.ellislab.com/bugs/detail/15461/#8283
or install an extension i developed for this.
http://devot-ee.com/add-ons/override_site_name

  1. internally the 'real' segments will be second.com/other/about
    while the browser only shows second.com/about

  2. the "allow some real template groups" part, allows to show member pages or 'real' template groups like the /specialgroup or /members without prepending other to the url.

  3. all assets (images, pdf, css, etc) still come from the main directory. The subdirectory 'other' only has an .htaccess and the index.php file in there.

2
  • It is a little over my head at the moment, but I will give this a try, thank you :) – Linda Antonsson Nov 29 '12 at 10:47
  • best is to have a setup locally on your machine and point two example.dev domains to it, and experiment a bit. – GDmac Nov 29 '12 at 17:23
2

Wouldn't a template setup as "about" fix this?

3
  • 1
    That's what I originally had, but then the Pages module came around and seemed like the better way of storing such information, not the least because it leaves it searchable along with other entry data. It seems a bit like a step back to have to resort to a template again. :) I've had the setup with Pages working fine on EE 1 with another workaround, but that one seems gone in EE 2 -- I have another topic on that matter: link. – Linda Antonsson Nov 28 '12 at 21:22
  • then don't make the "about" a page, but several entries for the different sub-sites. In the "about" template show the appropriate entry depending on, for instance, an early global var. – GDmac Nov 29 '12 at 7:45
  • I was thinking this as well. We have a number of sites we maintain using the old MSM method. Cost isn't the big issue, the fact that the main site should get all content, and then the sub sites get content parsed out to them is. We use /about as a template in 70% of the sub sites, but we don't use Pages, so I guess that's the distinction. – nonprofit_tech Feb 5 '13 at 21:39
2

This is a perfect example of where using MSM would make your setup so much easier to manage then the old method as Pages URI's are site dependent so you could have multiple /about/ segments and similar on a per site basis.

1
  • Absolutely, but as it stands at the moment I am unable to switch for various reasons. One being cost; for a hobby site with 6 sub-sections, MSM gets a touch pricey. There are also aspects of MSM that -- as far as I can tell from just looking at the documentation -- wouldn't be compatible with my setup; the old method allows less separation between sites than MSM seems to do and in parts that is crucial for how I ended up constructing my sites/sub-sections. – Linda Antonsson Nov 28 '12 at 21:38
0

I'm not sure if you're too far into this site to entertain using Structure, but it's easy to accomplish this with Structure. Your Structure URLs are stored separately from URL Titles. Initially, the Structure URL field copies the URL Title field, but you can then edit it to be any unique URL within its parent page/entry.

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.