I have an existing rails application at mydomain.com and wanted to include a wordpress blog at mydomain.com/blog. I’m using Apache and Passenger.
<VirutalHost> configuration has the
/srv/www/mydomain.com/public (which is itself a symbolic link to
/srv/www/mydomain.com/railsapp/public). For ease of maintenance, and to avoid any conflicts between rails and wordpress, I placed wordpress outside of the rails app at
However, I needed to tell Apache to redirect access to the wordpress resources which are not located in the
DocumentRoot. The solution? Create an Apache Alias. There’s an excellent descrpition in the Linode Library about Managing Resources with Apache mod_alias.
This got me through the wordpress install with the wp-admin/install.php. Unfortunately, I still couldn’t access my blog. The default rails error page still kept rearing its ugly head. Turns out that’s due to Passenger, which kept directing my non-file-specific traffic to my rails application (e.g., when trying to access mydomain.com/blog or mydomain.com/blog/wp-admin without a specific php file in the URL).
I found the fix for this at WordPress Answers. My final working configuration is below, with the additional fix in bold:
<VirtualHost x.x.x.x:80> ... DocumentRoot /srv/www/mydomain.com/public Options FollowSymLinks # an Alias for the wordpress blog Alias /blog /srv/www/mydomain.com/wordpress <Directory /srv/www/mydomain.com/wordpress> PassengerEnabled off # make the WordPress .htaccess file work AllowOverride all Order allow,deny Allow from all </Directory> ... </VirtualHost>