Multiple mt-static folders for MovableType on a shared webspace

Dieser Post wurde aus meiner alten WordPress-Installation importiert. Sollte es Darstellungsprobleme, falsche Links oder fehlende Bilder geben, bitte einfach hier einen Kommentar hinterlassen. Danke.

MovableType requires all websites and blogs to access one global mt-static directory and also cgi-bin must be accessible if a search or comment function should be used. But MT doesn't support multiple mt-static folders - at least, I didn't find anything about this on Google. Here is some way to share a global mt-static and cgi-bin folder without access to the Apache config.


back_to_parentTwo of the most common Apache configuration items might be the

Alias /mt-static /var/www/mt/mt-staticAlias /cgi-bin /var/www/mt
But that's not possible on a shared webspace without access to the Apache config.

I thought about using mod_rewrite which is also available on nearly all webservers, mostly because of the PHP design flaw of having .php files for everything while Perl offers frameworks which come with their own request parsers (like Dancer, Catalyst and many others). But mod_rewrite can't escape the current VirtualHost context (only rewrites the URL when being used in an .htaccess file, not the local directory used) and I don't know how multiple domains are configured on this webspace.

But nearly all webservers are using some kind of Linux nowadays and Linux (and Apache) supports symbolic links! FTP is unable to handle them and so is Windows, but Linux supports them at a very low level.

This webspace places places all subdomains and secondary domains into (custom) directory names below the main htdocs or html directory (where the primary domain lives). I created a test subdomain called subby and routed it to a directory called subby. Here is the new overall directory structure starting at the main domains root directory:

/Home of the main domain
/cgi-binMy MovableType script directory
/mt-staticStatic files for MovableType
/subbyDirectory for my test subdomain
Now I created a (very very) small script called symlink.cgi in the main cgi-bin directory:
#!/bin/bashecho "Content-type: text/html"echo ""echo "<pre>"cd ../subbyln -sv ../cgi-binln -sv ../mt-static
The script doesn't require Perl at all, it's basically a shell script (and please don't even think about complaining for the broken HTML!). I know, it's possible to create symlinks running ln from anywhere else than the target directory, but I didn't want to try around for a long time (because I don't use this feature very often). The script outputs a HTTP header and switches to preformatted mode before it walks out of the cgi-bin directory directly into the subby dir. Finally, it creates two symlinks for both magic directories. A simple HTTP call to the script's URL made it do it's job and I was able to access any file within the mt-static and also run the MT scripts living in the cgi-bin directory.

2 Kommentare. Schreib was dazu

  1. Müsste der Link zu "mod_rewrite" nicht eigentlich lauten ?

  2. Sebastian

    Danke für den Hinweis, der Fehler ist jetzt behoben.

Schreib was dazu

Die folgenden HTML-Tags sind erlaubt:<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>