How setup WordPress blog under Rails’s /public directory

1. Add a rewrite rule to both httpd.conf and /public/.htaccess file:


RewriteCond %{REQUEST_URI} ^/blog.*
RewriteRule .* - [L]

2. Switch blog url from WordPress admin and add this to /public/.htaccess:

RewriteEngine OnRewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

If you deployed your rails app using Passenger(mod_rails), you need to add this to make /blog url work:


<Location /blog>
PassengerEnabled off
</Location>

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.