If you wish to run Typo in a subdirectory of a web server (something like http://www.example.com/blog, instead of http://www.example.com or http://blog.example.com), then you need to make a couple small tweaks to Typo's install.
First, don't unpack Typo into a subdirectory of your web server. Put it somewhere outside of your web space and then use an Apache Alias (or something similar if you aren't using Apache) to link Typo's public/ directory into your webserver's namespace. If you have the ability to edit your Apache configs directly, then you'll want something like this
FastCgiConfig -initial-env RAILS_ENV=production Alias /subdirectory /path/to/rails/app/public <Directory /path/to/rails/app/public> Options ExecCGI FollowSymlinks AllowOverride All </Directory>If you're using a hosting provider, then check with them; almost all of them give you a tool for doing this via your site administration panel. If they don't, you can create a symlink from
/subdirectoryto
/path/to/rails/app/publicHere's the command to use if you have shell access:
ln -s /path/to/rails/app/public /subdirectory
You can't set RAILS_ENV, so you should edit
config/environment.rbto enable production mode (as explained in
README).
Once this is done, you'll need to edit
public/.htaccess. Look for the
RewriteBaseline. Uncomment it and change it to match the subdirectory that you're using. If you want to put your blog into http://www.example.com/typo, then make sure that it says
RewriteBase /typo
This should be all that you need.
Most of these techniques are derived from http://creativi.st/blog/articles/2005/06/10/railing-in-subdirectories
If you get 400 errors when trying to access your public directory without the trailing slash, i.e. www.yoursite.com/typo/ works fine but www.yoursite.com/typo breaks with a 400 error, see the tip on this page: http://www.bigbold.com/snippets/posts/show/560 There are a ton of ways to remedy this, some uglier than others, but this seems to be the cleanest.
