Skip to content


Subversion checkout URL

You can clone with
Download ZIP


RewriteBase modification after make. #13

merged 4 commits into from

2 participants


Enable modification of the RewriteBase directive through a property.


Could you explain in which situations this is needed?


Hey Kasperg,

This is needed when you install Drupal in a subdirectory, for ex: http://localhost/sites/drupal7
If you do not modify the RewriteBase, in some case, Drupal will redirect request to / instead of /sites/drupal7.

See documentation about this directly from at this address.


Thanks for the explanation.

I'd like to get this in but I have a few stylistic suggestions:

  1. The RewriteBase property should follow the same style as the rest of the project i.e. lower case
  2. As the feature only works when using drush_make I think this should be reflected in the code. The definition of the variable should be below the other project.make properties and properly also renamed to project.make.rewritebase. Otherwise consider making this an separate target in the build.
  3. Please add some inline documentation describing what this part of the build deals with. The comments are extracted when generating the documentation.

Great! Merged.

@kasperg kasperg merged commit 1d0c91b into reload:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 28, 2012
  1. @Polzme

    Adding support for .htaccess RewriteBase modification after the make.

    Polzme authored Pol Dell'Aiera committed
  2. @Polzme

    Adding RewriteBase default value, which is disabled.

    Polzme authored Pol Dell'Aiera committed
  3. @Polzme

    Fix typo.

    Polzme authored Pol Dell'Aiera committed
Commits on Apr 10, 2012
This page is out of date. Refresh to see the latest.
Showing with 17 additions and 1 deletion.
  1. +3 −0 
  2. +14 −1 build.xml
3 
@@ -15,6 +15,9 @@ drupal.db.url = sqlite:${project.drupal.dir}/database.sqlite
# drupal.make.nocore = 1
# The directory to make the site in relative to the project root directory
# drupal.make.dir = site
+# Should we update the RewriteBase directive in .htaccess ?
+# Ex: drupal.make.rewritebase = /drupal7
+# drupal.make.rewritebase =
# The directory containing the modules and themes for the project relative to the drupal root directory. If using Drush Make this is also where modules, themes, libraries etc. will be downloaded to.
project.code.dir = sites/all
15 build.xml
@@ -958,6 +958,19 @@ called from `init` target. -->
+ <if>
+ <isset property="drupal.make.rewritebase">
+ <then>
+ <reflexive file="${project.drupal.dir}/.htaccess">
+ <filterchain>
+ <replaceregexp>
+ <regexp pattern="# RewriteBase [\w/]*" replace="RewriteBase ${drupal.make.rewritebase}"/>
+ </replaceregexp>
+ </filterchain>
+ </reflexive>
+ </then>
+ </if>
<!-- Set property to prevent target from being executed multiple times -->
<property name="project.make.skip" value="true"/>
@@ -1300,4 +1313,4 @@ parsing installed. The task is primarily for template developers. -->
passthru="true" checkreturn="true"/>
Something went wrong with that request. Please try again.