Multisite Transparent extension

Discuss PivotX 2.0.x extensions here, and view extensions that are available for download.

Multisite Transparent extension

Postby hansfn » Tue Aug 24, 2010 7:11 am

This is the discussion topic for the Multisite Transparent extension.

This extension makes the links to resources like images and CSS
files much cleaner for a site that is run by PivotX in multi-site mode.

Visit http://extensions.pivotx.net/entry/38/multisite-transparent for download and more information.
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Multisite Transparent extension

Postby wilsoupcup » Wed Jun 01, 2011 3:21 pm

This extension works with a modified .htaccess file, which I have placed in the root directory of the pivotx installation. I don't know if this is right :?: or not, but I have gotten the multi-site mapped web-sites to insert and display images from their /pivotx/sites/anothersite.com/images directory rather than the images directory in the root of the file system. :D :) ;)

I am including this example of htaccess because I was confused in two ways about the documentation of the .htaccess file. At first it seemed ambiguous, was example.org my root site or a multi-site. Well obviously it is the multi-site.

Then I wondered "how will the rule would be limited to being applied only when the correct url?"

That is, I wanted to change a directory name when parsing the affected url. So I did this;

Removed by hansfn.

The code in the documentation is
Code: Select all
# Rules for transparent multi-site usage
RewriteRule ^images/(.*)$ pivotx/sites/example.org/images/$1 [L]
RewriteRule ^templates/(.*)$ pivotx/sites/example.org/templates/$1 [L]


Everything is working, maybe I am just complaining about documentation. Why do I think I need the condition? Maybe the documentation example was meant to be put in the /pivotx/sites/example.org/.htaccess - hmm, maybe .... someday I will try that.
wilsoupcup
 
Posts: 10
Joined: Fri Feb 18, 2011 7:12 pm

Re: Multisite Transparent extension

Postby hansfn » Wed Jun 01, 2011 4:49 pm

Thx for raising this issue. There is indeed one typo in the documentation - it should say "add the following lines to your virtual host definition" in stead of "add the following lines to your .htaccess file." However, if you read the docs it should be 110% clear that example.org is a multi-site install:
The standard link to an image `file.jpg` on a PivotX site (in multi-site mode) located at example.org is ...

Anyway, the correct solution (for example.org) if you have to use a .htaccess file is

Code: Select all
    # Rules for transparent multi-site usage in .htaccess
    RewriteCond %{HTTP_HOST} example.org
    RewriteRule ^images/(.*)$ pivotx/sites/example.org/images/$1 [L]
    RewriteCond %{HTTP_HOST} example.org
    RewriteRule ^templates/(.*)$ pivotx/sites/example.org/templates/$1 [L]

I have added this to the extension documentation (and uploaded a new zip file to extensions.pivotx.net).

PS! I removed your solution since it had many weaknesses.
hansfn
Developer
 
Posts: 3281
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Multisite Transparent extension

Postby wilsoupcup » Tue Jun 07, 2011 5:23 pm

The new .htaccess example gives me a clearer idea of how to map multiple sites. I had used symbolic links to share the templates but now I can split that up. I am still trying to think of a way to add a site without modifying .htaccess, although I use a bash script now to add new sites, i.e. the script just takes the new url as input and creates the directories. So I probably should modify that or re-write it in perl. In addition I would add some print statements to append the htaccess lines. Thanks for the affirmation on the conditions in .htaccess, that makes me feel as if I am starting to follow along.
wilsoupcup
 
Posts: 10
Joined: Fri Feb 18, 2011 7:12 pm


Return to 2.x Extensions

Who is online

Users browsing this forum: No registered users and 1 guest

cron