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.
Two of the most common Apache configuration items might be the
Alias /mt-static /var/www/mt/mt-staticAlias /cgi-bin /var/www/mtBut 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-bin | My MovableType script directory |
/mt-static | Static files for MovableType |
/subby | Directory for my test subdomain |
#!/bin/bashecho "Content-type: text/html"echo ""echo "<pre>"cd ../subbyln -sv ../cgi-binln -sv ../mt-staticThe 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-
Tamaro
13.07.2013 15:04
Antworten
-
Sebastian
13.07.2013 18:33
Antworten
Müsste der Link zu "mod_rewrite" nicht eigentlich lauten http://httpd.apache.org/docs/current/mod/mod_rewrite.html ?
Danke für den Hinweis, der Fehler ist jetzt behoben.