I’ve had a case where I need to run WordPress and Drupal side-by-side.
My preferred method is to run WordPress in a sub-directory of the Drupal installation.
So the server’s document root is set to: /var/www/html/oeit/. The Drupal instance is in: /var/www/html/oeit/drupal/. And the WordPress install is in /var/www/html/oeit/haiti-oer-symposium/.
Aside: We already have a rewrite rule in place because our Drupal installation was coded to require the subdirectory <server document root>/drupal. Yes, that’s not ideal. But the rewrite rule has been a heck of a lot easier than going through and changing the custom theme and testing it out. I’m not a Drupal developer, nor do I see a particular need to become one right now.
With the rewrite rule, I needed to be able to let the WordPress rewrite rules take precedence in the /var/www/html/oeit/haiti-oer-symposium/ directory. That actually gives part of a clue as to how the problem is solved.
I originally looked for stuff like “integrate wordpress and drupal” or “run wordpress in subdirectory of drupal”. Ultimately I ran across the suggestion to have Apache ignore anything going to the haiti-oer-symposium sub-directory.
I added the following code to our .htaccess file:
RewriteCond %{REQUEST_URI} !^/haiti-oer-symposium/
Here’s an explanation from rick_deckard about how this is doing it’s thing…
RewriteCond %{REQUEST_URI} !^blog
…
In that case it says
If the request URI does NOT (!) BEGIN (^) with “blog” and the requested URI does not map to a file or directory, then rewrite to invoke drupal.
Put another way
If the request URI is for my blog or a file or a directory, serve that straight up, without handing me off to drupal. So in the case of your blog, it passes you through to WP
…
[And this proved to be key...]
As for the leading slash – run the HTTP Live Headers plugin in Firefox to see what the server thinks your actual REQUEST_URI is (or use phpinfo() on your /blog directory). In my case at least, it does not want the leading slash.
[Our server did require the leading and trailing slashes.]
So, is it better to know what you’re doing, or just get lucky with copy and paste?
[view academic citations]
[hide academic citations]
AMA citation:
Muramatsu B. Running WordPress and Drupal side-by-side. Rocket Science. 2010. Available at: http://www.mura.org/2010/08/running-wordpress-and-drupal-side-by-side/. Accessed September 3, 2010.
APA citation:
Muramatsu, Brandon. (2010). Running WordPress and Drupal side-by-side. Retrieved September 3, 2010, from Rocket Science Web site, http://www.mura.org/2010/08/running-wordpress-and-drupal-side-by-side/
For more information on this plugin, visit Academic Citations.