Installing Wordpress in Drupal's sub directory

    User Rating: 5 / 5

    Star ActiveStar ActiveStar ActiveStar ActiveStar Active

    Last week one of my clients asked me to move her blog which is using wordpress to a new server under Drupal sub directory. So for example the main website is and this main site is using Drupal and I have to setup wordpress under blog directory or  As you know that Drupal htaccess file will intercept all requests to the main site and that will cause some problems to the wordpress site. Then what should we do is:

    Update Drupal Htaccess

    edit Drupal htaccess file so that it will exclude blog directory, we just need to add this line of code RewriteCond %{REQUEST_URI} !^blog before processing index.php, here is the complete code:

    # Pass all requests not referring directly to files in the filesystem to
    # index.php. Clean URLs are handled in drupal_environment_initialize().
    RewriteCond %{REQUEST_URI} !^blog
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^ index.php [L]

    Update Wordpress Htaccess

    edit you Wordpress htaccess file. we will add RewriteBase line since the wordpress will run under /blog directory and also we will update the rewrite rule to index.php file. here is the complete code:

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

    That's it now your wordpress will run under Drupal subdirectory without a problem

    Please publish modules in offcanvas position.