I have a Joomla website on root-level, and wordpress blog on /blog .
Inside root-level .htaccess, I need to implement non-www to www redirect, such as:
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
However, this causes a problem when going to www.example.com/blog (withoug trailing "/" at the end). I get redirected to http://www.example.com/cgi-bin/php53.cgi/blog/index.php
The php53.cgi file is there to turn on PHP 5.3 version. This is the content of that file:
#!/bin/sh
export PHP_FCGI_CHILDREN=3
exec /hsphere/shared/php53/bin/php-cgi
This is the .htaccess inside /blog directory:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
# END WordPress