Ariadne can host multiple sites in one tree. Each site can have it's own administrator, designer, users, etc. You can map domain names directly to the site in Ariadne, this will keep your site url's short and easy to remember.
We currently haven't researched how to do this with Microsoft's IIS webserver, so the following tutorial will only work with Apache.
Configuring Ariadne
For the tutorial we will assume there is a psite object at /sites/example/ in the Ariadne tree. Edit this object and enter the root url of this site, e.g. http://www.example.com/
. This url will from now on be used by Ariadne whenever the function make_url()
is called, either in your own object (pinp) templates, or in class (system) templates. This means that all links generated by Ariadne will use this site url as a base, unless the link points outside the site directory, or is part of a new psite.
If you do not have Apache set up to redirect requests for this url to Ariadne, this will break your site, keep the URL empty if you can't configure Apache, Ariadne will then use the generic urls, e.g.:
http://www.yoursite.com/ariadne/loader.php/sites/example/
Configuring Apache using Alias
Alias is a very easy way to redirect requests to Ariadne, however it has some drawbacks. If your site is multilingual, or uses sessions, alias isn't sufficient. Otherwise this wil work well enough:
<VirtualHost 127.0.0.1:80> ServerName www.example.com ServerAdmin webmaster@example.com DocumentRoot /var/www/yoursite Alias / /ariadne/loader.php/sites/example/ ErrorLog /var/log/apache/example.com-error.log TransferLog /var/log/apache/example.com-access.log </VirtualHost>
You can now either access the Ariadne backend via http://www.yoursite.com/ariadne/ or add another virtual host, ariadne.example.com, which has as Documentroot /var/www/yoursite/ariadne/.
Using the rewrite engine
To do the same for multilingual websites or a website where you do need
sessions, you'll need the Apache rewrite engine. So instead of the Alias line in the previous example, you'll need some rewrite magic:
RewriteEngine on # the RewriteCond excludes URL's which have # already been rewritten once RewriteCond %{REQUEST_URI} !^/ariadne/ RewriteRule ^(/-[^/]{4}-/|/)?([a-z]{2}/|/)?(.*) /ariadne/loader.php$1$2sites/example/$3
This rewrite rule matches with all the different types of requests, whether or not the language selection or a session id are in the URL. Session id's are recognized by the fact that they're always first in the URL and start and end with a '-'. The language selection is recognized by the fact that is always a code of two letters. This means that you should not create directories or other objects with a filename consisting of two letters (or other characters) as this rewriterule will break that.
The RewriteCond makes sure that URL's that have been rewritten once, won't be rewritten again. It also makes it possible to access the Ariadne back end of the site via the URL 'http://www.example.com/ariadne/'. To stop this behaviour, simply change the RewriteCond lines to:
RewriteCond %{REQUEST_URI} !^/ariadne/loader.php/
Using a PHP wrapper.
You can use the small siteloader script below to do the rewrite, this works with any webserver where you can configure the document root.
<?php /****************************************** siteloader.php wrapper for loader.php Simplifies Apache rewrite Gabriel Wicke <2002 at gabrielwicke.de> Copy it to the same directory as loader.php (usually 'www') and point the document root to /full/path/to/siteloader.php/site/[enter the full ariadne path of the site here]/endsite/. Example document root: /full/path/to/siteloader.php/site/sitesdir/psite1/endsite/ *******************************************/ require_once("./ariadne.inc"); require_once($ariadne."/configs/ariadne.phtml"); $PATH_INFO=$HTTP_SERVER_VARS["PATH_INFO"]; $re="^/site/(.*)/endsite/"; if (eregi($re,$PATH_INFO,$matches)) { $site=$matches[1]; $PATH_INFO=substr($PATH_INFO,strlen($matches[0])-1); $HTTP_SERVER_VARS["PHP_SELF"]=$PATH_INFO; } $re="^/"; if (eregi($re,$PATH_INFO,$matches)) { $ldSessionId=$matches[1]; $PATH_INFO=substr($PATH_INFO,strlen($matches[0])-1); $NEWPATH_INFO="/-$ldSessionId-"; } $split=strpos(substr($PATH_INFO, 1), "/"); $ldNLS=substr($PATH_INFO, 1, $split); if ($AR->nls->list[$ldNLS]) { // valid language $NEWPATH_INFO.="/$ldNLS"; $PATH_INFO=substr($PATH_INFO, $split+1); } $NEWPATH_INFO.='/'.$site.$PATH_INFO; $HTTP_SERVER_VARS["PATH_INFO"]=$NEWPATH_INFO; include("./loader.php"); /*****************************/ // uncomment this to switch on debug mode // debugon("all"); /*****************************/ ?>