Today I came across a situation where I was deploying a PHP-based webapp written in Lithium and running on a Rackspace cloud site. In my scenario, I noticed 2 symptoms (appearing differently, but having the same cause).
- if the Lithium app is a subdirectory of another webapp (in my example, the main site is WordPress), you will always get a WordPress “Oops! The page you are looking for does not exist.” error.
- if the Lithium app is in the root, you will get an “Internal Server Error” page.
As it turns out, the problem is the .htaccess file included with Lithium.
I don’t think there’s anything wrong with the .htaccess per se, but under Rackspace you seem to have to include the “RewriteBase” directive.
So, as a result, you must edit all 3 .htaccess files in your Lithium project thus:
- /.htaccess – RewriteBase /
- /app/.htaccess – RewriteBase /app/
- /app/webroot/.htaccess – RewriteBase /app/webroot/
If your webapp is a subdirectory, this subdirectory name will need to prepended to RewriteBase path:
- /.htaccess – RewriteBase /subdir/
- /app/.htaccess – RewriteBase /subdir/app/
- /app/webroot/.htaccess – RewriteBase /subdir/app/webroot/
And presto, it now magically works!