Take the 2-minute tour ×

I am migrating an existing WordPress blog into a subdirectory of a new rails 3 app (deployed on Apache2 / Ubuntu 10).

I have PHP/MySQL installed, and I have a standard rails app folder structure in the production env:


Inside /public/, I want to copy the Wordpress files into /home/blog/, so:

../public/home/blog/-wp stuff-

I've already migrated all the files as well as the database, and updated wp-config.php per the directons given in the Wordpress codex.

However, when I try to access the blog: (www.example.com/home/blog), I get a 403-forbidden message.

I've already ensured my vhost config is setup correctly (I can access the rails app without issue) and the http.d directive is as follows:

<Directory /var/www/railsapp/public/>
    Options +FollowSymLinks
    AllowOverride all
    Order allow,deny
    Allow from all

Is there something I'm missing?

My ../home/blog/.htaccess file is also correct (I believe):

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /home/blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /home/blog/index.php [L]

# END WordPress

What could be the problem?

share|improve this question
Create a file in your blog folder. Call it test.html. Can you access it? If you can't then this isn't really a WordPress issue, and would probably be best dealt with at ServerFault or Webmasters –  anu Jul 8 '11 at 10:44
This isn't an answer to your question, but rather a suggestion: why not setup your blog on a subdomain? –  Matthew Boynes Jan 30 '12 at 20:16
add comment

migrated from stackoverflow.com Jul 8 '11 at 2:03

This question came from our site for professional and enthusiast programmers.

1 Answer

I had a similar problem, but handled the VirtualHost configuration in a different way:

  1. Used an Apache mod_alias to redirect what for you is /home/blog/ to a path outside of /var/www/railsapp/public/ (e.g., /var/www/wordpress)
  2. Then, for that new hosted directory I had to declare PassengerEnabled off to avoid getting the standard rails error message.

I've wrote this up in more detail in a blog post about hosting wordpress in a rails subdirectory. My VirtualHost declaration ended up looking like this:

<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
        AllowOverride all   # make the WordPress .htaccess file work
        Order allow,deny
        Allow from all

share|improve this answer
add comment

Your Answer

