By contextcanada on
We are working with example.ca to launch a WordPress blog. We have tried to install it in a sub-directory of the url example.ca which is in Drupal, called example.ca/blog but we are having issues with images and embedded links that do work or display. The install was done through cpanel and Fantastico. I have searched for answers to this and it might be something to do with index.php and .htaccess files that are part of the root directory? Can this be fixed or do we need to move the blog into a sub domain?
Comments
You need to make sure your
You need to make sure your rewrites for Drupal specifically exclude the /blog/* path, then it should all work fine.
But it begs the question of why you don't simply turn on the blog module in Drupal.
Don't get me wrong, I use Wordpress when all I want is blog. But if I'm going to install Drupal anyway, I would just use the Drupal blog function.
I do think that Wordpress is easier for most people to get their heads around and that may be an issue for you depending on who will do the actual blogging, but Drupal can be set up for a user with limited permissions that will present few choices. You can add in the Dashboard module and have something pretty close to WordPress without having to maintain two packages.
Rewrites
You need to make sure your rewrites for Drupal specifically exclude the /blog/* path, then it should all work fine.
Can you provide me with more detail on your suggestion?
As to the reasons, they are exactly as you mentioned, easier for the client to use and less involvement for me.
In your .htaccess for Drupal
In your .htaccess for Drupal where it's checking for files and directories, you need to add another rewrite condition like
RewriteCond %{REQUEST_URI} !^blog
That means that Drupal won't try to rewrite your /blog* URLs and let them pass on to WordPress
your code was a little off
your code was a little off (didn't work so Iused the following).
=========[ start of .htaccess snippet]==========
RewriteEngine on
#
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} "/folder1/" [OR]
RewriteCond %{REQUEST_URI} "/folder2/"
RewriteRule (.*) $1 [L]
#
====================[ end ]=====================
Got this from node 30334 in the forums.
I added this to my .htaccess file, but it didn't solve anything! Any thoughts on this. Hope the view and weather are nice there.
RewriteEngine on
#
# stuff to let through (ignore)
RewriteCond %{REQUEST_URI} "/blog/" [OR]
RewriteCond %{REQUEST_URI} "/blog/"
RewriteRule (.*) $1 [L]
#
Well, since my code is in
Well, since my code is in actual use, to run Gallery within a Drupal install...
It is not *complete* - it needs to be integrated with your other rewrite conditions and rules.
My code says this:
If the request URI does NOT begin with "blog" then....
And the rest of your code needs to give the other conditions such as the standard Drupal file and directory checks (the -f, -d conditions in the drupal default .htaccess) and then the drupal rewrite rule.
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
Your code says this
If the Request URL is "/blog/" or "/blog/" then take that URL and rewrite it to be the same as it was before and quit.
In any case, you don't need quotes if there's no whitespace.
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.
So depending on what else you have, it might look like this
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_URI} !^blog
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
Took the easier route
I bailed out, because I do not understand the "code" well enough to fix the problem. So I installed the "blog" as a sub domain and it seems to work, so far. I really appreciate your taking the time to respond. I would definitely like to try your solution at some point. If you are interested I could provide you with the htaccess file and you can see what I have done so far?
I may need further assistance with it and would like to stay in contact. It would seem that you are the only source I can find that appreciates how this could actually work.
Many thanks for your input.
Terry
All you need is the code at
All you need is the code at the end of my last post. Try putting *just* that in your .htaccess. It should work.
If it doesn't, look at your server logs - access and error - and your Drupal Watchdog logs. Those will tell you what's going wrong and how to adjust your rewrites.
The main thing is to read the mod_rewrite manual. It's a bit of geek speak, and understanding regular expressions is helpful, but if you plan to be running sites long term, trust me, learning some basics of regular expressions and mod_rewrite is going to add years to your life. Okay, maybe not, but it's a powerful toolkit and worth learning.
Apprication
Just want to appricate you for your intense desire to help others. God bless you.
Thank you! What a kind
Thank you! What a kind comment!
cannot get drupal to see my subdirectory
Hello,
I am having the same issue as the other writer. I am trying to install wordpress under a blog folder and no matter where I put the rewriteCond above it doesn't serve up the page correctly.
Below is my htaccess code:
thanks
You also need to add a .htaccess
You also need to add a .htaccess file to your wordpress sub-directory
This worked for me. The mod_rewrite section of the .htaccess file in the root Drupal directory looks like below:
And I then copied a unmodified Drupal .htaccess file into the wordpress sub-directory and it all worked :)
The installation of WordPress
The installation of WordPress might be completely installed but try to check every details from your codes to your sub directory it might be the hindrance of running your blog site. Before, when I have some doubt or question about installer wordpress, I go to the trusted site where I can learn more knowledge about WordPress. Even in formation wordpress, this wordpress training you will realize yourself, your website or your blog and so totally personalized.
The topic is old but still
The topic is old but still relevant. Just wanted to share my solution to this problem.
Those kindda of answers is why I love Drupal !
Thanks , Man
This worked for me perfectly (after 1 hour of htaccess mud fight :( )
It Worked!
Thank you Baart! Your solution worked!
I know this thread is a bit
I know this thread is a bit old, but what about doing this with a multi-site instance of Drupal? Where would the WP sub-directory be located and would there be any other required htaccess rules?
Thanks.
It makes no difference, a bad idea, regardless!
Obviously, the wp folder shouldn't interfere with your drupal site folders. Meaning they have to be named differently.
Consider it bad organization to mix the two and wonder what your business case is.
I basically agree with you.
I basically agree with you. But the cases I've seen are things like this: someone wants functionality that Drupal provides, but has a thriving blog already and they really like Wordpress. So the regular bloggers can stick with WP and not learn something new and leave Drupal to a more knowledgeable webmaster.
Eight years ago, when I first replied, the use cases were more obvious. Drupal and Wordpress were both much more limited and there were lots of things neither did well (which is why I was running separate gallery software). Nowdays, Wordpress is so much more powerful than it was and so much easier to use and maintain than Drupal (especially D8), that most people should just use Wordpress.
On the other hand, nothing I've seen replaces Drupal's Fields + Views. So if you want structured data and you want to present it in various ways, nothing I know of is close to Drupal.
But having Drupal and Wordpress for the same site gives you all the complexity of both, all the security issues of both, all the maintenance headaches of both. People should ask themselves if the feature they *must* have from Wordpress or from Drupal is really, truly worth the hassle of maintaining two systems for years to come.
Not objecting to using them both !
Objecting to mixing them. There is absolutely no need to mix them. You can still combine them when they are installed separately, each in their own folder. That is what sub domains are for.